diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2017-05-10 06:31:01 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-10 06:31:01 +0000 |
commit | fb810fb8ca77d2a902844225ab0b1888405489f0 (patch) | |
tree | f07e7f784651a72bb7a01a22c59f7afeb7a7e0c9 | |
parent | b5af75bfa0d7bcfded8b784cc5dd7559560ae9e8 (diff) | |
parent | c994ec653805b069af48b3c7cf3fa23a81e3498d (diff) | |
download | tests-fb810fb8ca77d2a902844225ab0b1888405489f0.tar.gz |
Also test link-local ping on connected sockets. am: 173399ea76 am: 400466d39f
am: c994ec6538
Change-Id: Ib84af57885c8039d332b7998e57410c149511efc
-rwxr-xr-x | net/test/ping6_test.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/test/ping6_test.py b/net/test/ping6_test.py index cf9e2c2..ff39e84 100755 --- a/net/test/ping6_test.py +++ b/net/test/ping6_test.py @@ -615,15 +615,16 @@ class Ping6Test(multinetwork_base.MultiNetworkBaseTest): upstream net: 5e45789 net: ipv6: Fix ping to link-local addresses. """ - s = net_test.IPv6PingSocket() for mode in ["oif", "ucast_oif", None]: s = net_test.IPv6PingSocket() for netid in self.NETIDS: + s2 = net_test.IPv6PingSocket() dst = self._RouterAddress(netid, 6) self.assertTrue(dst.startswith("fe80:")) if mode: self.SelectInterface(s, netid, mode) + self.SelectInterface(s2, netid, mode) scopeid = 0 else: scopeid = self.ifindices[netid] @@ -637,11 +638,21 @@ class Ping6Test(multinetwork_base.MultiNetworkBaseTest): self.assertRaisesErrno( errno.EINVAL, s.sendto, net_test.IPV6_PING, (dst, 55, 0, otherscopeid)) + self.assertRaisesErrno( + errno.EINVAL, + s.connect, (dst, 55, 0, otherscopeid)) + # Try using both sendto and connect/send. + # If we get a reply, we sent the packet out on the right interface. s.sendto(net_test.IPV6_PING, (dst, 123, 0, scopeid)) - # If we got a reply, we sent the packet out on the right interface. self.assertValidPingResponse(s, net_test.IPV6_PING) + # IPV6_UNICAST_IF doesn't work on connected sockets. + if mode != "ucast_oif": + s2.connect((dst, 123, 0, scopeid)) + s2.send(net_test.IPV6_PING) + self.assertValidPingResponse(s2, net_test.IPV6_PING) + def testMappedAddressFails(self): s = net_test.IPv6PingSocket() s.sendto(net_test.IPV6_PING, (net_test.IPV6_ADDR, 55)) |