Disable RIOTest route lifetime assert on kernels before 3.13
Also add a small delay after each RIO to give the kernel time to notice
updates before making assertions about routing table state.
Note that bullhead and angler have backported
commit: f104a567e673f382b09542a8dc3500aa689957b4
ipv6: use rt6_get_dflt_router to get default router in rt6_route_rcv
which makes it difficult to predict how earlier kernels will behave.
Bug: 33333670
Test: net_test has now been run on android-msm-angler-3.10 and
android-msm-bullhead-3.10 in addition to android common kernels.
Change-Id: I98fe507e06686af9a2b431735b7e5e554661b280
diff --git a/net/test/multinetwork_test.py b/net/test/multinetwork_test.py
index 9afd906..0ade759 100755
--- a/net/test/multinetwork_test.py
+++ b/net/test/multinetwork_test.py
@@ -630,9 +630,13 @@
PRF = 0
self.SetAcceptRaRtInfoMaxPlen(PLEN)
self.SendRIO(RTLIFETIME, PLEN, PREFIX, PRF)
+ # Give the kernel time to notice our RA
+ time.sleep(0.01)
self.assertTrue(self.FindRoutesWithDestination(PREFIX))
# RIO with rtlifetime = 0 should remove from routing table
self.SendRIO(0, PLEN, PREFIX, PRF)
+ # Give the kernel time to notice our RA
+ time.sleep(0.01)
self.assertFalse(self.FindRoutesWithDestination(PREFIX))
@unittest.skipUnless(HAVE_MAX_PLEN and multinetwork_base.HAVE_AUTOCONF_TABLE,
@@ -645,6 +649,8 @@
self.SetAcceptRaRtInfoMaxPlen(plen)
# RIO with plen > max_plen should be ignored
self.SendRIO(RTLIFETIME, plen + 1, PREFIX, PRF)
+ # Give the kernel time to notice our RA
+ time.sleep(0.01)
routes = self.FindRoutesWithDestination(PREFIX)
self.assertFalse(routes)
@@ -663,15 +669,16 @@
# RIO with prefix length = 0, should overwrite default route lifetime
# note that the RIO lifetime overwrites the RA lifetime.
self.SendRIO(RTLIFETIME, PLEN, PREFIX, PRF)
+ # Give the kernel time to notice our RA
+ time.sleep(0.01)
default = self.FindRoutesWithGateway()
self.assertTrue(default)
- if net_test.LINUX_VERSION < (3, 13, 0):
- # Versions earlier than 3.13 overwrite the default route lifetime with
- # zero and unset RTF_EXPIRES in rt6i_flags after receiving a RIO with a
- # zero length prefix. Later versions explicitly check for a zero length
- # prefix and handle that as a special case.
- self.assertEquals(self.GetRouteExpiration(default[0]), 0)
- else:
+ if net_test.LINUX_VERSION > (3, 12, 0):
+ # Vanilla linux earlier than 3.13 handles RIOs with zero length prefixes
+ # incorrectly. There's nothing useful to assert other than the existence
+ # of a default route.
+ # TODO: remove this condition after pulling bullhead/angler backports to
+ # other 3.10 flavors.
self.assertGreater(self.GetRouteExpiration(default[0]), self.RA_VALIDITY)
@unittest.skipUnless(HAVE_MAX_PLEN and multinetwork_base.HAVE_AUTOCONF_TABLE,