6 test -e /dev/net/tun || exit $EXIT_SKIP_TEST
7 ip netns list || exit $EXIT_SKIP_TEST
13 echo [STEP] Create network namespaces
15 ip netns add ping.test1
16 ip netns add ping.test2
19 ip netns del ping.test1
20 ip netns del ping.test2
23 echo [STEP] Initialize two nodes
28 set Interface ping.test1
34 # shellcheck disable=SC2016
35 create_script foo tinc-up "
36 ip link set dev \$INTERFACE netns ping.test1
37 ip netns exec ping.test1 ip addr add $ip_foo/$mask dev \$INTERFACE
38 ip netns exec ping.test1 ip link set \$INTERFACE up
44 set Interface ping.test2
49 # shellcheck disable=SC2016
50 create_script bar tinc-up "
51 ip link set dev \$INTERFACE netns ping.test2
52 ip netns exec ping.test2 ip addr add $ip_bar/$mask dev \$INTERFACE
53 ip netns exec ping.test2 ip link set \$INTERFACE up
56 echo [STEP] Exchange configuration files
58 tinc foo export | tinc bar exchange | tinc foo import
60 echo [STEP] Start tinc
65 wait_script foo tinc-up
66 wait_script bar tinc-up
68 echo [STEP] The nodes should not be able to ping each other if there is no connection
70 must_fail ip netns exec ping.test1 ping -W1 -c3 $ip_bar
72 echo [STEP] After connecting they should be
74 create_script bar hosts/foo-up
76 tinc bar add ConnectTo foo
77 wait_script bar hosts/foo-up
79 ip netns exec ping.test1 ping -W1 -c3 $ip_bar