tinc: Add clean sources of 1.1pre10.
[tomato.git] / release / src / router / tinc / test / invite-join.test
blobdbe6f8aeafa05e4040cad19dc4495c3bf1af9498
1 #!/bin/sh
3 . ./testlib.sh
5 # Initialize one node
7 $tinc $c1 <<EOF
8 init foo
9 set DeviceType dummy
10 set Mode switch
11 set Broadcast no
12 del Port
13 set Address localhost
14 set Port 32751
15 start $r1
16 EOF
18 # Generate an invitation and let another node join the VPN
20 sleep 1
22 $tinc $c1 invite bar | $tinc $c2 join
24 # Test equivalence of host config files
26 cmp $d1/hosts/foo $d2/hosts/foo
27 test "`grep ^ECDSAPublicKey $d1/hosts/bar`" = "`grep ^ECDSAPublicKey $d2/hosts/bar`"
29 # Test Mode, Broadcast and ConnectTo statements
31 test `$tinc $c2 get Mode` = switch
32 test `$tinc $c2 get Broadcast` = no
33 test `$tinc $c2 get ConnectTo` = foo
35 # Check whether the new node can join the VPN
37 $tinc $c2 << EOF
38 set DeviceType dummy
39 set Port 0
40 start $r2
41 EOF
43 sleep 1
45 test `$tinc $c1 dump reachable nodes | wc -l` = 2
46 test `$tinc $c2 dump reachable nodes | wc -l` = 2
48 $tinc $c2 stop
49 $tinc $c1 stop