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
14 set Subnet 192.168.1.1
15 set Interface ping.test1
21 cat >$d1/tinc-up <<EOF
23 ip netns add ping.test1
24 ip link set dev \$INTERFACE netns ping.test1
25 ip netns exec ping.test1 ip addr add 192.168.1.1/24 dev \$INTERFACE
26 ip netns exec ping.test1 ip link set \$INTERFACE up
31 set Subnet 192.168.1.2
32 set Interface ping.test2
37 cat >$d2/tinc-up <<EOF
39 ip netns add ping.test2
40 ip link set dev \$INTERFACE netns ping.test2
41 ip netns exec ping.test2 ip addr add 192.168.1.2/24 dev \$INTERFACE
42 ip netns exec ping.test2 ip link set \$INTERFACE up
45 # Exchange configuration files
47 $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
56 # The nodes should not be able to ping each other if there is no connection
58 ip netns exec ping.test1 ping -W1 -c3 192.168.1.2 && exit 1
60 # After connecting they should be
62 $tinc $c2 add ConnectTo foo
65 ip netns exec ping.test1 ping -W1 -c3 192.168.1.2
71 ip netns del ping.test2
72 ip netns del ping.test1