OSDN Git Service

net_test environment changes
authorErik Kline <ek@google.com>
Tue, 14 Oct 2014 06:52:37 +0000 (15:52 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Mon, 2 Feb 2015 08:47:29 +0000 (17:47 +0900)
- update run_net_test.sh to config-enable privacy addresses
  and optimistic DAD (both apparently off by default)
- update mark_test's SendRA to support passing in the ND
  retranstimer parameter

Change-Id: I348609bcef16e0cb7b1f9cbfd33ef2ab4dcda917

tests/net_test/mark_test.py
tests/net_test/run_net_test.sh

index 2605246..788cc19 100755 (executable)
@@ -428,19 +428,25 @@ class MultiNetworkTest(net_test.NetworkTest):
     return f
 
   @classmethod
-  def SendRA(cls, netid):
+  def SendRA(cls, netid, retranstimer=None):
     validity = 300                 # seconds
     validity_ms = validity * 1000  # milliseconds
     macaddr = cls.RouterMacAddress(netid)
     lladdr = cls._RouterAddress(netid, 6)
 
+    if retranstimer is None:
+      # If no retrans timer was specified, pick one that's as long as the
+      # router lifetime. This ensures that no spurious ND retransmits
+      # will interfere with test expectations.
+      retranstimer = validity
+
     # We don't want any routes in the main table. If the kernel doesn't support
     # putting RA routes into per-interface tables, configure routing manually.
     routerlifetime = validity if HAVE_AUTOCONF_TABLE else 0
 
     ra = (scapy.Ether(src=macaddr, dst="33:33:00:00:00:01") /
           scapy.IPv6(src=lladdr, hlim=255) /
-          scapy.ICMPv6ND_RA(retranstimer=validity_ms,
+          scapy.ICMPv6ND_RA(retranstimer=retranstimer,
                             routerlifetime=routerlifetime) /
           scapy.ICMPv6NDOptSrcLLAddr(lladdr=macaddr) /
           scapy.ICMPv6NDOptPrefixInfo(prefix=cls.IPv6Prefix(netid),
@@ -611,7 +617,7 @@ class MultiNetworkTest(net_test.NetworkTest):
     elif mode == "ucast_oif":
       self.SetUnicastInterface(s, self.ifindices.get(netid, 0))
     else:
-      raise ValueError("Unkown interface selection mode %s" % mode)
+      raise ValueError("Unknown interface selection mode %s" % mode)
 
   def BuildSocket(self, version, constructor, netid, routing_mode):
     uid = self.UidForNetid(netid) if routing_mode == "uid" else None
index a4ce035..0ef1e2c 100755 (executable)
@@ -7,6 +7,7 @@ OPTIONS="$OPTIONS NETFILTER NETFILTER_ADVANCED NETFILTER_XTABLES"
 OPTIONS="$OPTIONS NETFILTER_XT_MARK NETFILTER_XT_TARGET_MARK"
 OPTIONS="$OPTIONS IP_NF_IPTABLES IP_NF_MANGLE"
 OPTIONS="$OPTIONS IP6_NF_IPTABLES IP6_NF_MANGLE INET6_IPCOMP"
+OPTIONS="$OPTIONS IPV6_PRIVACY IPV6_OPTIMISTIC_DAD"
 # For 3.1 kernels, where devtmpfs is not on by default.
 OPTIONS="$OPTIONS DEVTMPFS DEVTMPFS_MOUNT"