summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-12-15 14:57:36 +0900
committerLorenzo Colitti <lorenzo@google.com>2015-02-02 17:47:30 +0900
commitde7c4f07a185470587e7940cb0324823b68ccf28 (patch)
tree4d8fe6ba1e9cf7acd480285bb6cca931ed47429c /tests
parentf36fcbacdd0b86bdc2ba1f7059df57c3423019ba (diff)
downloadextras-de7c4f07a185470587e7940cb0324823b68ccf28.tar.gz
Manually add directly-connected routes as well as default routes
Currently, the manual routing configuration that we use when running the tests on a kernel that does not have the accept_ra_rt_table sysctl does not add directly-connected routes to the per-interface routing tables. This does not allow us to test on-link connectivity unless the sysctl is present. Remove this restriction and enable testOnlinkCommunication. Also make testLeftoverRoutes conditional on HAVE_AUTOCONF_TABLE, because without per-interface routing tables, sending an RA does not result in the creation of a new routing table. Change-Id: I16177cf374040b87a78e7455b05b11b956f4e7ee
Diffstat (limited to 'tests')
-rw-r--r--tests/net_test/iproute.py4
-rwxr-xr-xtests/net_test/mark_test.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/net_test/iproute.py b/tests/net_test/iproute.py
index 3611aebc..804d1e09 100644
--- a/tests/net_test/iproute.py
+++ b/tests/net_test/iproute.py
@@ -62,6 +62,7 @@ RTPROT_STATIC = 4
# Route scope values (rtm_scope).
RT_SCOPE_UNIVERSE = 0
+RT_SCOPE_LINK = 253
# Named routing tables.
RT_TABLE_UNSPEC = 0
@@ -522,8 +523,9 @@ class IPRoute(object):
mark, uid):
"""Adds, deletes, or queries a route."""
family = self._AddressFamily(version)
+ scope = RT_SCOPE_UNIVERSE if nexthop else RT_SCOPE_LINK
rtmsg = RTMsg((family, prefixlen, 0, 0, RT_TABLE_UNSPEC,
- RTPROT_STATIC, RT_SCOPE_UNIVERSE, RTN_UNICAST, 0)).Pack()
+ RTPROT_STATIC, scope, RTN_UNICAST, 0)).Pack()
if command == RTM_NEWROUTE and not table:
# Don't allow setting routes in table 0, since its behaviour is confusing
# and differs between IPv4 and IPv6.
diff --git a/tests/net_test/mark_test.py b/tests/net_test/mark_test.py
index cee3e7e2..d3b8d9f1 100755
--- a/tests/net_test/mark_test.py
+++ b/tests/net_test/mark_test.py
@@ -491,9 +491,15 @@ class MultiNetworkTest(net_test.NetworkTest):
cls.iproute.AddNeighbour(version, router, macaddr, ifindex)
if do_routing:
cls.iproute.AddRoute(version, table, "default", 0, router, ifindex)
+ if version == 6:
+ cls.iproute.AddRoute(version, table,
+ cls.IPv6Prefix(netid), 64, None, ifindex)
else:
if do_routing:
cls.iproute.DelRoute(version, table, "default", 0, router, ifindex)
+ if version == 6:
+ cls.iproute.DelRoute(version, table,
+ cls.IPv6Prefix(netid), 64, None, ifindex)
if version == 4:
cls.iproute.DelNeighbour(version, router, macaddr, ifindex)
cls.iproute.DelAddress(cls._MyIPv4Address(netid), 24, ifindex)
@@ -1374,7 +1380,6 @@ class RATest(MultiNetworkTest):
self.SendRA(netid)
CheckIPv6Connectivity(True)
- @unittest.skipUnless(HAVE_AUTOCONF_TABLE, "our manual routing doesn't do PIO")
def testOnlinkCommunication(self):
"""Checks that on-link communication goes direct and not through routers."""
for netid in self.tuns:
@@ -1413,6 +1418,7 @@ class RATest(MultiNetworkTest):
self.ExpectPacketOn(netid, msg, expected)
# This test documents a known issue: routing tables are never deleted.
+ @unittest.skipUnless(HAVE_AUTOCONF_TABLE, "no support for per-table autoconf")
def testLeftoverRoutes(self):
def GetNumRoutes():
return len(open("/proc/net/ipv6_route").readlines())