• Home
  • Raw
  • Download

Lines Matching refs:s

64   s = socket(AF_INET6, SOCK_DGRAM, 0)
65 s.bind(("::", 0))
66 s.connect((s.getsockname()))
69 s.close()
76 s = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)
77 s.close()
132 def assertSockInfoMatchesSocket(self, s, info): argument
134 family = s.getsockopt(net_test.SOL_SOCKET, net_test.SO_DOMAIN)
137 src, sport = s.getsockname()[0:2]
142 dst, dport = s.getpeername()[0:2]
146 self.assertRaisesErrno(ENOTCONN, s.getpeername)
148 mark = s.getsockopt(SOL_SOCKET, net_test.SO_MARK)
196 for s in socketpair:
197 s.close()
298 for s in socketpair:
299 diag_msg = self.sock_diag.FindSockDiagFromFd(s)
350 diag_msgs = [self.sock_diag.FindSockDiagFromFd(s) for s in pair5]
410 s = socket(family, SOCK_DGRAM, 0)
411 self.SelectInterface(s, self.RandomNetid(), "mark")
412 s.connect((self.GetRemoteSocketAddress(version), 53))
416 req = self.sock_diag.DiagReqFromSocket(s)
418 req.id.cookie = s.getsockopt(net_test.SOL_SOCKET, net_test.SO_COOKIE, 8)
430 self.assertSockInfoMatchesSocket(s, self.sock_diag.GetSockInfo(req))
487 s = random.choice(socketpair)
489 self.sock_diag.CloseSocketFromFd(s)
491 diag_msg = self.sock_diag.FindSockDiagFromFd(s)
499 self.assertSocketConnected(s)
578 s = self.BuildSocket(version, net_test.TCPSocket, netid, "mark")
584 self.assertRaisesErrno(EINPROGRESS, s.connect, (dstsockaddr, 53))
589 s.close()
629 self.CheckRstOnClose(self.s, None, False, msg)
680 def FindChildSockets(self, s): argument
682 d = self.sock_diag.FindSockDiagFromFd(self.s)
702 d = self.sock_diag.FindSockDiagFromFd(self.s)
704 children = self.FindChildSockets(self.s)
727 self.CheckRstOnClose(self.s, None, expect_reset, msg)
752 self.s.close()
757 self.s.close()
770 self.assertRaisesErrno(ENOTCONN, self.s.recv, 4096)
771 self.CloseDuringBlockingCall(self.s, lambda sock: sock.accept(), EINVAL)
772 self.assertRaisesErrno(ECONNABORTED, self.s.send, "foo")
773 self.assertRaisesErrno(EINVAL, self.s.accept)
775 self.assertEquals("", self.s.recv(4096))
792 s = net_test.Socket(family, SOCK_STREAM, IPPROTO_TCP)
793 self.SelectInterface(s, self.netid, "mark")
797 s.bind(("", 0))
798 _, sport = s.getsockname()[:2]
800 s, lambda sock: sock.connect((remotesockaddr, 53)), ECONNABORTED)
931 def BindToRandomPort(self, s, addr): argument
936 s.bind((addr, port))
953 s = self.BuildSocket(version, net_test.UDPSocket, netid, "mark")
954 self.SelectInterface(s, netid, "mark")
955 s.connect((dst, 53))
956 self.sock_diag.CloseSocketFromFd(s)
957 self.assertEqual((unspec, 0), s.getsockname()[:2])
960 s = self.BuildSocket(version, net_test.UDPSocket, netid, "mark")
962 s.bind((src, 0))
963 s.connect((dst, 53))
964 port = s.getsockname()[1]
965 self.sock_diag.CloseSocketFromFd(s)
966 self.assertEqual((src, 0), s.getsockname()[:2])
969 s = self.BuildSocket(version, net_test.UDPSocket, netid, "mark")
970 port = self.BindToRandomPort(s, "")
971 s.connect((dst, 53))
972 self.sock_diag.CloseSocketFromFd(s)
973 self.assertEqual((unspec, port), s.getsockname()[:2])
976 s = self.BuildSocket(version, net_test.UDPSocket, netid, "mark")
978 port = self.BindToRandomPort(s, src)
979 self.sock_diag.CloseSocketFromFd(s)
980 self.assertEqual((src, port), s.getsockname()[:2])
986 s = net_test.UDPSocket(family)
987 self.SelectInterface(s, random.choice(self.NETIDS), "mark")
991 s.connect((addr, 53))
992 self.assertEquals(3, s.send("foo"))
993 self.CloseDuringBlockingCall(s, lambda sock: sock.recv(4096),
997 self.assertRaisesErrno(EDESTADDRREQ, s.send, "foo")
998 self.assertEquals(3, s.sendto("foo", (addr, 53)))
1001 self.CloseDuringBlockingCall(s, lambda sock: sock.recv(4096),
1007 s = socket(AF_INET6, socktype, 0)
1008 self.SelectInterface(s, random.choice(self.NETIDS), "mark")
1010 s.listen(1)
1013 s.connect((self.GetRemoteAddress(6), 53))
1018 EPERM, self.sock_diag.CloseSocketFromFd, s)
1020 self.sock_diag.CloseSocketFromFd(s)
1021 self.assertRaises(ValueError, self.sock_diag.CloseSocketFromFd, s)
1054 def SockInfoMatchesSocket(self, s, info): argument
1056 self.assertSockInfoMatchesSocket(s, info)
1062 def SocketDescription(s): argument
1063 return "%s -> %s" % (str(s.getsockname()), str(s.getpeername()))
1067 for s in sockets:
1070 if self.SockInfoMatchesSocket(s, info):
1073 (self.SocketDescription(s), match, info))
1074 matches[s] = info
1075 self.assertTrue(s in matches, "Did not find socket %s in dump" %
1076 self.SocketDescription(s))
1111 def SetRandomMark(s): argument
1114 s.setsockopt(SOL_SOCKET, net_test.SO_MARK, mark)
1117 def assertSocketMarkIs(self, s, mark): argument
1118 diag_msg, attrs = self.sock_diag.FindSockInfoFromFd(s)
1121 diag_msg, attrs = self.sock_diag.FindSockInfoFromFd(s)
1158 s = socket(family, SOCK_DGRAM, 0)
1159 mark = self.SetRandomMark(s)
1160 s.connect(("", 53))
1161 self.assertSocketMarkIs(s, mark)
1162 s.close()
1166 s = socket(family, SOCK_STREAM, IPPROTO_SCTP)
1167 s.bind((addr, 0))
1168 s.listen(1)
1169 mark = self.SetRandomMark(s)
1170 self.assertSocketMarkIs(s, mark)
1174 s.close()