tinc-gui: Reformat codebase according to PEP8
[tinc] / test / ping.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 # Skip this test if we aren't root
6
7 test "`id -u`" = "0" || exit 77
8
9 # Initialize two nodes
10
11 $tinc $c1 <<EOF
12 init foo
13 set Mode switch
14 set Interface ping.test
15 set Port 32573
16 set Address localhost
17 EOF
18
19 cat >$d1/tinc-up <<EOF
20 #!/bin/sh
21 ifconfig \$INTERFACE up
22 EOF
23
24 $tinc $c2 <<EOF
25 init bar
26 set Mode switch
27 set DeviceType multicast
28 set Device 233.252.0.1 32754
29 add ConnectTo foo
30 EOF
31
32 # Exchange configuration files
33
34 $tinc $c1 export | $tinc $c2 exchange | $tinc $c1 import
35
36 # Ensure we have a working multicast route
37
38 ip route replace 233.252.0.0/16 dev lo
39
40 # Start pong program in background
41
42 ./pong 233.252.0.1 32754 10.6.5.5 &
43 pong=$!
44
45 # Start tinc and try to ping
46
47 $tinc $c1 start $r1
48 $tinc $c2 start $r2
49
50 sleep 1
51
52 ping -r -I ping.test -c3 10.6.5.5
53
54 # Clean up
55
56 kill $pong
57 $tinc $c2 stop
58 $tinc $c1 stop