Home
last modified time | relevance | path

Searched refs:addr (Results 1 – 19 of 19) sorted by relevance

/kernel/tests/net/test/
Dcsocket_test.py39 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(b"foo", addr)
49 data, addr = csocket.Recvfrom(s, 4096, 0)
51 self.assertEqual(sockaddr, addr)
59 def CheckRecvmsg(self, family, addr): argument
[all …]
Dcsocket.py91 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 …]
Dneighbour_test.py83 addr = self._RouterAddress(netid, 6)
85 self.iproute.UpdateNeighbour(6, addr, None, ifindex, NUD_FAILED)
129 def GetNeighbour(self, addr, ifindex): argument
130 version = csocket.AddressVersion(addr)
132 if args["NDA_DST"] == addr:
135 def GetNdEntry(self, addr): argument
136 return self.GetNeighbour(addr, self.ifindex)
141 def assertNeighbourState(self, state, addr): argument
142 self.assertEqual(state, self.GetNdEntry(addr)[0].state)
144 def assertNeighbourAttr(self, addr, name, value): argument
[all …]
Dtcp_nuke_addr_test.py37 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()
85 def CheckNukeAddrUnsupported(self, socketpair, addr): argument
87 self.assertRaisesErrno(errno.ENOTTY, KillAddrIoctl, addr)
Danycast_test.py70 def AnycastSetsockopt(self, s, is_add, netid, addr): argument
73 ipv6mreq = IPv6Mreq((addr, ifindex))
86 addr = self.MyAddress(6, netid)
87 self.assertIsNotNone(addr)
89 addr = inet_pton(AF_INET6, addr)
90 addr = addr[:8] + os.urandom(8)
91 self.AnycastSetsockopt(s, True, netid, addr)
113 self.AnycastSetsockopt(s, False, netid, addr)
Dsock_diag.py154 addr, nla_data = cstruct.Read(nla_data, csocket.SockaddrStorage)
155 if addr.family == AF_INET:
156 addr = csocket.SockaddrIn(addr.Pack())
157 elif addr.family == AF_INET6:
158 addr = csocket.SockaddrIn6(addr.Pack())
159 data.append(addr)
231 addr, prefixlen, port = arg
232 family = AF_INET6 if ":" in addr else AF_INET
233 addr = inet_pton(family, addr)
234 arg = InetDiagHostcond((family, prefixlen, port)).Pack() + addr
[all …]
Dnf_test.py48 def CheckRejectedTcp(self, version, addr): argument
55 sock.connect((addr, 53))
68 def CheckRejectedUdp(self, version, addr): argument
75 sock.sendto(net_test.UDP_PAYLOAD, (addr, 53))
Dnet_test.py232 addr = {4: "0.0.0.0", 5: "::", 6: "::"}[version]
234 sock.bind((addr, 0))
251 def CreateSocketPair(family, socktype, addr): argument
254 listensock.bind((addr, 0))
255 addr = listensock.getsockname()
310 def CanonicalizeIPv6Address(addr): argument
311 return inet_ntop(AF_INET6, inet_pton(AF_INET6, addr))
379 def MakeFlowLabelOption(addr, label): argument
393 addr = inet_pton(AF_INET6, addr)
394 assert len(addr) == 16
[all …]
Dmultinetwork_base.py78 def MakePktInfo(version, addr, ifindex): argument
80 if not addr:
81 addr = {4: "0.0.0.0", 6: "::"}[version]
82 if addr:
83 addr = inet_pton(family, addr)
85 return csocket.In6Pktinfo((addr, ifindex)).Pack()
87 return csocket.InPktinfo((ifindex, addr, b"\x00" * 4)).Pack()
198 addr = cls.MyAddress(version, netid)
199 return "::ffff:" + addr if version == 5 else addr
498 addr = self.GetRemoteAddress(version)
[all …]
Dleak_test.py45 data, addr = csocket.Recvfrom(s, 4096)
47 self.assertEqual(None, addr)
Dsock_diag_test.py78 family, addr = random.choice([
82 socketpair = net_test.CreateSocketPair(family, socktype, addr)
85 socketpairs[(addr, sport, dport)] = socketpair
194 addr = self.sock_diag.GetSourceAddress(diag_msg)
197 if (addr, sport, dport) in self.socketpairs:
198 cookies[(addr, sport, dport)] = diag_msg.id.cookie
199 elif (addr, dport, sport) in self.socketpairs:
200 cookies[(addr, sport, dport)] = diag_msg.id.cookie
376 def CheckSocketCookie(self, inet, addr): argument
378 socketpair = net_test.CreateSocketPair(inet, SOCK_STREAM, addr)
[all …]
Diproute.py538 def _Address(self, version, command, addr, prefixlen, flags, scope, ifindex): argument
542 ifaddrmsg += self._NlAttrIPAddress(IFA_ADDRESS, family, addr)
544 ifaddrmsg += self._NlAttrIPAddress(IFA_LOCAL, family, addr)
669 def _Neighbour(self, version, is_add, addr, lladdr, dev, state, flags=0): argument
681 ndmsg += self._NlAttrIPAddress(NDA_DST, family, addr)
687 def AddNeighbour(self, version, addr, lladdr, dev): argument
688 self._Neighbour(version, True, addr, lladdr, dev, NUD_PERMANENT)
690 def DelNeighbour(self, version, addr, lladdr, dev): argument
691 self._Neighbour(version, False, addr, lladdr, dev, 0)
693 def UpdateNeighbour(self, version, addr, lladdr, dev, state): argument
[all …]
Dxfrm.py236 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)
Dbpf_test.py121 addr = {4: "127.0.0.1", 6: "::1"}[version]
122 sock.bind((addr, 0))
123 addr = sock.getsockname()
124 sockaddr = csocket.Sockaddr(addr)
126 sock.sendto(b"foo", addr)
Dping6_test.py287 addr, unused_port = src
288 self.assertGreaterEqual(len(addr), len("1.1.1.1"))
291 addr, unused_port, flowlabel, scope_id = src # pylint: disable=unbalanced-tuple-unpacking
292 self.assertGreaterEqual(len(addr), len("::"))
296 if addr.startswith("fe80::"):
890 data, addr, cmsg = csocket.Recvmsg(s, 4096, 1024, csocket.MSG_ERRQUEUE)
901 self.assertEqual(csocket.Sockaddr(("2001:4860:4860::8888", 0)), addr)
Dmultinetwork_test.py1386 def ExpectNoRoute(self, addr, oif, mark, uid): argument
1389 routes = self.iproute.GetRoutes(addr, oif, mark, uid)
1396 def ExpectRoute(self, addr, oif, mark, uid): argument
1397 routes = self.iproute.GetRoutes(addr, oif, mark, uid)
1401 def CheckGetRoute(self, version, addr): argument
1402 self.ExpectNoRoute(addr, 0, 0, 0)
1405 self.ExpectRoute(addr, 0, 0, uid)
1406 self.ExpectNoRoute(addr, 0, 0, 0)
Dxfrm_test.py617 msg, addr = sock.recvfrom(1024)
619 self.assertEqual((remote_addr, remote_port), addr[:2])
681 msg, addr = sock.recvfrom(1024)
683 self.assertEqual((remote_addr, remote_port), addr[:2])
Dxfrm_tunnel_test.py699 addr = cls._GetLocalAddress(version, tunnel.netid)
701 tunnel.addrs[version] = addr
703 cls.iproute.AddAddress(addr, prefixlen, ifindex)
707 cls.iproute.DelAddress(addr, prefixlen, ifindex)
/kernel/tests/net/test/rootfs/
Dcommon.sh61 ip addr add 10.0.2.15/24 broadcast 10.0.2.255 dev eth0