In some linux distributions, such as RHEL7U0RC1, when we create a veth pair
by "ip link add type veth", the ipv6 address for veth interfaces won't be
automatically generated, so the "par_chld_ipv6" test case in containers test
will fail. This is because in these distirbutions, the "/proc/sys/net/ipv6/
conf/veth*/disable_ipv6" is true for veth interfaces. Please see kernel
"Documentation/networking/ip-sysctl.txt" for more detailed information.

In this patch, we will enable IPv6 address autoconfiguration for veth interfaces
if disabled.

Signed-off-by: Xiaoguang Wang <[email protected]>
---
 testcases/kernel/containers/netns/initialize.sh | 18 ++++++++++++++++++
 testcases/kernel/containers/netns/paripv6.sh    |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/testcases/kernel/containers/netns/initialize.sh 
b/testcases/kernel/containers/netns/initialize.sh
index a2c3f47..9270f60 100755
--- a/testcases/kernel/containers/netns/initialize.sh
+++ b/testcases/kernel/containers/netns/initialize.sh
@@ -114,3 +114,21 @@ create_veth()
     ip link show > /tmp/net2
     eval `diff /tmp/net1 /tmp/net2 | awk -F": "  '/^> [0-9]*:/ { print "dev" 
i+0 "=" $2; i++  }'`
 }
+
+enable_veth_ipv6()
+{
+    local veth=$1
+    local veth_ipv6_status=$(cat /proc/sys/net/ipv6/conf/$veth/disable_ipv6)
+    if [ -z "$veth_ipv6_status" ];then
+        tst_resm TFAIL "Error: cat /proc/sys/net/ipv6/conf/$veth/disable_ipv6"\
+            "failed"
+        exit 1
+    elif [ "$veth_ipv6_status" = "1" ]; then
+        echo 0 > /proc/sys/net/ipv6/conf/$veth/disable_ipv6
+        if [ $? -ne 0 ];then
+            tst_resm TFAIL "Error: set " \
+                "/proc/sys/net/ipv6/conf/$veth/disable_ipv6 to 1 failed"
+            exit 1
+        fi
+    fi
+}
diff --git a/testcases/kernel/containers/netns/paripv6.sh 
b/testcases/kernel/containers/netns/paripv6.sh
index ac8ee57..25d780a 100755
--- a/testcases/kernel/containers/netns/paripv6.sh
+++ b/testcases/kernel/containers/netns/paripv6.sh
@@ -55,6 +55,8 @@ status=0
     else
         debug "INFO: vnet0 = $vnet0 , vnet1 = $vnet1"
     fi
+    enable_veth_ipv6 $vnet0
+    enable_veth_ipv6 $vnet1
 
 
     ifconfig $vnet0 $IP1/24 up > /dev/null 2>&1
-- 
1.8.2.1


------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to