Support running tests on NetBSD 8.2.
[tinc] / test / legacy-protocol.test
1 #!/bin/sh
2
3 . ./testlib.sh
4
5 echo [STEP] Initialize two nodes
6
7 tinc foo <<EOF
8 init foo
9 set DeviceType dummy
10 set Port 30060
11 set Address localhost
12 add Subnet 10.98.98.1
13 set PingTimeout 2
14 EOF
15
16 tinc bar <<EOF
17 init bar
18 set DeviceType dummy
19 set Port 0
20 add Subnet 10.98.98.2
21 set PingTimeout 2
22 set MaxTimeout 2
23 EOF
24
25 echo [STEP] Exchange host config files
26
27 tinc foo export | tinc bar exchange | tinc foo import
28 tinc bar add ConnectTo foo
29
30 echo [STEP] Foo 1.1, bar 1.0
31
32 tinc bar set ExperimentalProtocol no
33 tinc foo del bar.Ed25519PublicKey
34 tinc bar del foo.Ed25519PublicKey
35
36 create_script foo hosts/bar-up
37 create_script bar hosts/foo-up
38
39 start_tinc foo
40 start_tinc bar
41
42 wait_script foo hosts/bar-up
43 wait_script bar hosts/foo-up
44
45 require_nodes foo 2
46 require_nodes bar 2
47
48 tinc bar stop
49 tinc foo stop
50
51 test -z "$(tinc foo get bar.Ed25519PublicKey)"
52 test -z "$(tinc bar get foo.Ed25519PublicKey)"
53
54 echo [STEP] Foo 1.1, bar upgrades to 1.1
55
56 tinc bar del ExperimentalProtocol
57
58 start_tinc foo
59 start_tinc bar
60
61 wait_script foo hosts/bar-up
62 wait_script bar hosts/foo-up
63
64 require_nodes foo 2
65 require_nodes bar 2
66
67 tinc bar stop
68 tinc foo stop
69
70 test -n "$(tinc foo get bar.Ed25519PublicKey)"
71 test -n "$(tinc bar get foo.Ed25519PublicKey)"
72
73 echo [STEP] Bar downgrades, must no longer be allowed to connect
74
75 tinc bar set ExperimentalProtocol no
76
77 create_script foo subnet-up
78 start_tinc foo
79 wait_script foo subnet-up
80
81 create_script bar subnet-up
82 start_tinc bar
83 wait_script bar subnet-up
84
85 # There is no reliable way to wait for 'not connecting'.
86 sleep 10
87
88 require_nodes foo 1
89 require_nodes bar 1