5 # Skip this test if we aren't root or if "ip netns" does not exist
7 test "`id -u`" = "0" || exit 77
8 ip netns list || exit 77
10 # Initialize two nodes
15 set Interface ping.test1
20 cat >$d1/tinc-up <<EOF
22 ip netns add ping.test1
23 ip link set dev \$INTERFACE netns ping.test1
24 ip netns exec ping.test1 ip addr add 192.168.1.1/24 dev \$INTERFACE
25 ip netns exec ping.test1 ip link set \$INTERFACE up
31 set Interface ping.test2
35 cat >$d2/tinc-up <<EOF
37 ip netns add ping.test2
38 ip link set dev \$INTERFACE netns ping.test2
39 ip netns exec ping.test2 ip addr add 192.168.1.2/24 dev \$INTERFACE
40 ip netns exec ping.test2 ip link set \$INTERFACE up
43 # Exchange configuration files
45 $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
54 # The nodes should not be able to ping each other if there is no connection
56 ip netns exec ping.test1 ping -W1 -c3 192.168.1.2 && exit 1
58 # After connecting they should be
60 $tinc $c2 add ConnectTo foo
63 ip netns exec ping.test1 ping -W1 -c3 192.168.1.2
69 ip netns del ping.test2
70 ip netns del ping.test1