/kernel/tests/net/test/ |
D | csocket_test.py | 39 def _BuildSocket(self, family, addr): argument 41 s.bind((addr, 0)) 44 def CheckRecvfrom(self, family, addr): argument 45 s = self._BuildSocket(family, addr) 46 addr = s.getsockname() 47 sockaddr = csocket.Sockaddr(addr) 48 s.sendto("foo", addr) 49 data, addr = csocket.Recvfrom(s, 4096, 0) 51 self.assertEqual(sockaddr, addr) 59 def CheckRecvmsg(self, family, addr): argument [all …]
|
D | csocket.py | 91 def AddressVersion(addr): argument 92 return 6 if ":" in addr else 4 112 def Sockaddr(addr): argument 113 if ":" in addr[0]: 115 if len(addr) == 4: 116 addr, port, flowinfo, scope_id = addr 118 (addr, port), flowinfo, scope_id = addr, 0, 0 119 addr = socket.inet_pton(family, addr) 121 addr, scope_id)) 124 addr, port = addr [all …]
|
D | neighbour_test.py | 83 addr = self._RouterAddress(netid, 6) 85 self.iproute.UpdateNeighbour(6, addr, None, ifindex, NUD_FAILED) 134 def GetNeighbour(self, addr, ifindex): argument 135 version = csocket.AddressVersion(addr) 137 if args["NDA_DST"] == addr: 140 def GetNdEntry(self, addr): argument 141 return self.GetNeighbour(addr, self.ifindex) 146 def assertNeighbourState(self, state, addr): argument 147 self.assertEqual(state, self.GetNdEntry(addr)[0].state) 149 def assertNeighbourAttr(self, addr, name, value): argument [all …]
|
D | tcp_nuke_addr_test.py | 37 def KillAddrIoctl(addr): argument 46 family, _, _, _, _ = getaddrinfo(addr, None, AF_UNSPEC, SOCK_DGRAM, 0, 49 addr = inet_pton(AF_INET6, addr) 50 ifreq = In6Ifreq((addr, 128, LOOPBACK_IFINDEX)).Pack() 52 addr = inet_pton(AF_INET, addr) 53 sockaddr = csocket.SockaddrIn((AF_INET, 0, addr)).Pack() 86 def CheckNukeAddrUnsupported(self, socketpair, addr): argument 88 self.assertRaisesErrno(errno.ENOTTY, KillAddrIoctl, addr)
|
D | anycast_test.py | 69 def AnycastSetsockopt(self, s, is_add, netid, addr): argument 72 ipv6mreq = IPv6Mreq((addr, ifindex)) 85 addr = self.MyAddress(6, netid) 86 self.assertIsNotNone(addr) 88 addr = inet_pton(AF_INET6, addr) 89 addr = addr[:8] + os.urandom(8) 90 self.AnycastSetsockopt(s, True, netid, addr) 112 self.AnycastSetsockopt(s, False, netid, addr)
|
D | sock_diag.py | 151 addr, nla_data = cstruct.Read(nla_data, csocket.SockaddrStorage) 152 if addr.family == AF_INET: 153 addr = csocket.SockaddrIn(addr.Pack()) 154 elif addr.family == AF_INET6: 155 addr = csocket.SockaddrIn6(addr.Pack()) 156 data.append(addr) 228 addr, prefixlen, port = arg 229 family = AF_INET6 if ":" in addr else AF_INET 230 addr = inet_pton(family, addr) 231 arg = InetDiagHostcond((family, prefixlen, port)).Pack() + addr [all …]
|
D | nf_test.py | 48 def CheckRejectedTcp(self, version, addr): argument 55 sock.connect((addr, 53)) 67 def CheckRejectedUdp(self, version, addr): argument 74 sock.sendto(net_test.UDP_PAYLOAD, (addr, 53))
|
D | net_test.py | 172 addr = {4: "0.0.0.0", 5: "::", 6: "::"}[version] 174 sock.bind((addr, 0)) 191 def CreateSocketPair(family, socktype, addr): argument 194 listensock.bind((addr, 0)) 195 addr = listensock.getsockname() 248 def CanonicalizeIPv6Address(addr): argument 249 return inet_ntop(AF_INET6, inet_pton(AF_INET6, addr)) 314 def MakeFlowLabelOption(addr, label): argument 328 addr = inet_pton(AF_INET6, addr) 329 assert len(addr) == 16 [all …]
|
D | leak_test.py | 45 data, addr = csocket.Recvfrom(s, 4096) 47 self.assertEqual(None, addr)
|
D | multinetwork_base.py | 66 def MakePktInfo(version, addr, ifindex): argument 68 if not addr: 69 addr = {4: "0.0.0.0", 6: "::"}[version] 70 if addr: 71 addr = inet_pton(family, addr) 73 return csocket.In6Pktinfo((addr, ifindex)).Pack() 75 return csocket.InPktinfo((ifindex, addr, "\x00" * 4)).Pack() 183 addr = cls.MyAddress(version, netid) 184 return "::ffff:" + addr if version == 5 else addr 477 addr = self.GetRemoteAddress(version) [all …]
|
D | qtaguid_test.py | 86 addr = {4: "127.0.0.1", 6: "::1"}[version] 87 s.bind((addr, 0)) 88 addr = s.getsockname() 89 self.assertRaisesErrno(errno.EPERM, s.sendto, "foo", addr) 91 s.sendto("foo", addr) 94 self.assertEqual(sockaddr, addr)
|
D | sock_diag_test.py | 109 family, addr = random.choice([ 113 socketpair = net_test.CreateSocketPair(family, socktype, addr) 116 socketpairs[(addr, sport, dport)] = socketpair 222 addr = self.sock_diag.GetSourceAddress(diag_msg) 225 if (addr, sport, dport) in self.socketpairs: 226 cookies[(addr, sport, dport)] = diag_msg.id.cookie 227 elif (addr, dport, sport) in self.socketpairs: 228 cookies[(addr, sport, dport)] = diag_msg.id.cookie 385 def CheckSocketCookie(self, inet, addr): argument 387 socketpair = net_test.CreateSocketPair(inet, SOCK_STREAM, addr) [all …]
|
D | pf_key.py | 232 def MakeSadbExtAddr(self, exttype, addr): argument 233 prefixlen = {AF_INET: 32, AF_INET6: 128}[addr.family] 234 packed = addr.Pack()
|
D | xfrm.py | 236 def RawAddress(addr): argument 238 family = AF_INET6 if ":" in addr else AF_INET 239 return inet_pton(family, addr) 242 def PaddedAddress(addr): argument 244 padded = RawAddress(addr)
|
D | bpf_test.py | 135 addr = {4: "127.0.0.1", 6: "::1"}[version] 136 sock.bind((addr, 0)) 137 addr = sock.getsockname() 138 sockaddr = csocket.Sockaddr(addr) 140 sock.sendto("foo", addr)
|
D | ping6_test.py | 288 addr, unused_port = src 289 self.assertGreaterEqual(len(addr), len("1.1.1.1")) 292 addr, unused_port, flowlabel, scope_id = src # pylint: disable=unbalanced-tuple-unpacking 293 self.assertGreaterEqual(len(addr), len("::")) 297 if addr.startswith("fe80::"): 836 data, addr, cmsg = csocket.Recvmsg(s, 4096, 1024, csocket.MSG_ERRQUEUE) 854 self.assertEqual(csocket.Sockaddr(("2001:4860:4860::8888", 0)), addr)
|
D | xfrm_test.py | 516 msg, addr = sock.recvfrom(1024) 518 self.assertEqual((remote_addr, remote_port), addr[:2]) 579 msg, addr = sock.recvfrom(1024) 581 self.assertEqual((remote_addr, remote_port), addr[:2])
|