summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2014-07-17 00:50:37 +0900
committerLorenzo Colitti <lorenzo@google.com>2015-02-02 17:47:29 +0900
commitd7c3975614112794fccf8a576d442c19e801daa8 (patch)
tree9b18a1d801f1b5f78cbb490ab17921ca63d13ec8
parente84f2c1e83621d3afc7b00b45cba2edeb96d1412 (diff)
downloadextras-d7c3975614112794fccf8a576d442c19e801daa8.tar.gz
Make net_test work on 3.1 kernels.
Change-Id: Ic8d2ae94a2f359ea2d3166d057f769c0692e944b
-rwxr-xr-xtests/net_test/mark_test.py11
-rwxr-xr-xtests/net_test/run_net_test.sh4
2 files changed, 12 insertions, 3 deletions
diff --git a/tests/net_test/mark_test.py b/tests/net_test/mark_test.py
index 7fcc2482..aa922fa8 100755
--- a/tests/net_test/mark_test.py
+++ b/tests/net_test/mark_test.py
@@ -89,13 +89,16 @@ IPV6_MARK_REFLECT_SYSCTL = "/proc/sys/net/ipv6/fwmark_reflect"
SYNCOOKIES_SYSCTL = "/proc/sys/net/ipv4/tcp_syncookies"
TCP_MARK_ACCEPT_SYSCTL = "/proc/sys/net/ipv4/tcp_fwmark_accept"
+LINUX_VERSION = LinuxVersion()
+
HAVE_AUTOCONF_TABLE = os.path.isfile(AUTOCONF_TABLE_SYSCTL)
HAVE_MARK_REFLECT = os.path.isfile(IPV4_MARK_REFLECT_SYSCTL)
HAVE_TCP_MARK_ACCEPT = os.path.isfile(TCP_MARK_ACCEPT_SYSCTL)
HAVE_EXPERIMENTAL_UID_ROUTING = HaveUidRouting()
-LINUX_VERSION = LinuxVersion()
+# The IP[V6]UNICAST_IF socket option was added between 3.1 and 3.4.
+HAVE_UNICAST_IF = LINUX_VERSION >= (3, 4, 0)
class ConfigurationError(AssertionError):
@@ -958,6 +961,7 @@ class OutgoingTest(MultiNetworkTest):
"""Checks that oif routing selects the right outgoing interface."""
self.CheckOutgoingPackets("oif")
+ @unittest.skipUnless(HAVE_UNICAST_IF, "no support for UNICAST_IF")
def testUcastOifRouting(self):
"""Checks that ucast oif routing selects the right outgoing interface."""
self.CheckOutgoingPackets("ucast_oif")
@@ -967,7 +971,9 @@ class OutgoingTest(MultiNetworkTest):
if use_connect:
modes = ["oif"]
else:
- modes = ["mark", "oif", "ucast_oif"]
+ modes = ["mark", "oif"]
+ if HAVE_UNICAST_IF:
+ modes += ["ucast_oif"]
for mode in modes:
s = net_test.UDPSocket(self.GetProtocolFamily(version))
@@ -1380,6 +1386,7 @@ class RATest(MultiNetworkTest):
mymac = self.MyMacAddress(netid)
desc, expected = Packets.NS(myaddr, dstaddr, mymac)
msg = "Sending UDP packet to on-link destination: expecting %s" % desc
+ time.sleep(0.0001) # Required to make the test work on kernel 3.1(!)
self.ExpectPacketOn(netid, msg, expected)
# Send an NA.
diff --git a/tests/net_test/run_net_test.sh b/tests/net_test/run_net_test.sh
index 48cc2b9e..a4ce0357 100755
--- a/tests/net_test/run_net_test.sh
+++ b/tests/net_test/run_net_test.sh
@@ -6,7 +6,9 @@ OPTIONS="$OPTIONS TUN SYN_COOKIES IP_ADVANCED_ROUTER IP_MULTIPLE_TABLES"
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"
+OPTIONS="$OPTIONS IP6_NF_IPTABLES IP6_NF_MANGLE INET6_IPCOMP"
+# For 3.1 kernels, where devtmpfs is not on by default.
+OPTIONS="$OPTIONS DEVTMPFS DEVTMPFS_MOUNT"
# How many tap interfaces to create.
NUMTAPINTERFACES=2