Test many IPv6, IPv6-mapped-IPv4 and IPv4 connections to loopback,
connecting to IPv6 dual-stack sockets listening on ::.
This test is done in three different ways which trigger issues on
different kernel versions or hardware (all resolved in current
versions).
Signed-off-by: David Luyer <luyer@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2200 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index b67810c..4d22308 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -93,6 +93,16 @@
return "%s/%s" % (long_to_ip(masked_ip), mask_bits)
+def get_ip_local_port_range():
+ match = re.match(r'\s*(\d+)\s*(\d+)\s*$',
+ read_one_line('/proc/sys/net/ipv4/ip_local_port_range'))
+ return (int(match.group(1)), int(match.group(2)))
+
+
+def set_ip_local_port_range(lower, upper):
+ write_one_line('/proc/sys/net/ipv4/ip_local_port_range',
+ '%d %d\n' % (lower, upper))
+
def read_one_line(filename):
return open(filename, 'r').readline().rstrip('\n')