[LTP] [PATCH] containers: fix dev name in create_veth()

Hangbin Liu
2015-08-12T02:44:15Z

The new version of iproute2 will show veth device like veth0@veth1, but we
won't get a dev proc entry like this. Fix the dev name to avoid error like
/proc/sys/net/ipv4/conf/veth0@veth1/proxy_arp: No such file or directory

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
testcases/kernel/containers/netns/netns_initialize.sh | 2 ++
1 file changed, 2 insertions(+)

diff --git a/testcases/kernel/containers/netns/netns_initialize.sh b/testcases/kernel/containers/netns/netns_initialize.sh
index d44a02b..71d935a 100755
--- a/testcases/kernel/containers/netns/netns_initialize.sh
+++ b/testcases/kernel/containers/netns/netns_initialize.sh
@@ -113,6 +113,8 @@ create_veth()
sleep 1
ip link show > /tmp/net2
eval `diff /tmp/net1 /tmp/net2 | awk -F": " '/^> [0-9]*:/ { print "dev" i+0 "=" $2; i++ }'`
+ dev0=$(echo $dev0 | cut -f1 -d'@')
+ dev1=$(echo $dev1 | cut -f1 -d'@')
}

# return 1 if disabled originally, 0 for enabled originally.
--
1.9.3