OSDN Git Service

Deal with flowlabel randomization.
authorLorenzo Colitti <lorenzo@google.com>
Fri, 11 Dec 2015 07:30:17 +0000 (16:30 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Mon, 14 Dec 2015 08:01:27 +0000 (17:01 +0900)
Recent kernels randomize flowlabels by default. This causes our
packet comparisons to fail. Fix this by copying over the
flowlabel like we do with the IP id and the DF bit.

Change-Id: I8cf2685e622d89ca25fab443bab3bb1c3079b076

tests/net_test/multinetwork_base.py

index 2282bba..c178bdd 100644 (file)
@@ -517,6 +517,12 @@ class MultiNetworkBaseTest(net_test.NetworkTest):
       actualip.flags &= 5
       actualip.chksum = None  # Change the header, recalculate the checksum.
 
+    # Blank out the flow label, since new kernels randomize it by default.
+    actualipv6 = actual.getlayer("IPv6")
+    expectedipv6 = expected.getlayer("IPv6")
+    if actualipv6 and expectedipv6:
+      actualipv6.fl = expectedipv6.fl
+
     # Blank out UDP fields that we can't predict (e.g., the source port for
     # kernel-originated packets).
     actualudp = actual.getlayer("UDP")
@@ -529,7 +535,6 @@ class MultiNetworkBaseTest(net_test.NetworkTest):
     # Since the TCP code below messes with options, recalculate the length.
     if actualip:
       actualip.len = None
-    actualipv6 = actual.getlayer("IPv6")
     if actualipv6:
       actualipv6.plen = None