@@ -38,9 +38,8 @@ ip0() { pretty 0 "ip $*"; ip -n $netns0 "$@"; }
38
38
ip1 () { pretty 1 " ip $* " ; ip -n $netns1 " $@ " ; }
39
39
ip2 () { pretty 2 " ip $* " ; ip -n $netns2 " $@ " ; }
40
40
sleep () { read -t " $1 " -N 1 || true ; }
41
- waitiperf () { pretty " ${1//* -} " " wait for iperf:5201" ; while [[ $( ss -N " $1 " -tlp ' sport = 5201' ) != * iperf3* ]]; do sleep 0.1; done ; }
42
- waitncatudp () { pretty " ${1//* -} " " wait for udp:1111" ; while [[ $( ss -N " $1 " -ulp ' sport = 1111' ) != * ncat* ]]; do sleep 0.1; done ; }
43
- waitncattcp () { pretty " ${1//* -} " " wait for tcp:1111" ; while [[ $( ss -N " $1 " -tlp ' sport = 1111' ) != * ncat* ]]; do sleep 0.1; done ; }
41
+ waitiperf () { pretty " ${1//* -} " " wait for iperf:5201 pid $2 " ; while [[ $( ss -N " $1 " -tlpH ' sport = 5201' ) != * \" iperf3\" ,pid= $2 ,fd= * ]]; do sleep 0.1; done ; }
42
+ waitncatudp () { pretty " ${1//* -} " " wait for udp:1111 pid $2 " ; while [[ $( ss -N " $1 " -ulpH ' sport = 1111' ) != * \" ncat\" ,pid= $2 ,fd= * ]]; do sleep 0.1; done ; }
44
43
waitiface () { pretty " ${1//* -} " " wait for $2 to come up" ; ip netns exec " $1 " bash -c " while [[ \$ (< \" /sys/class/net/$2 /operstate\" ) != up ]]; do read -t .1 -N 0 || true; done;" ; }
45
44
46
45
cleanup () {
@@ -119,22 +118,22 @@ tests() {
119
118
120
119
# TCP over IPv4
121
120
n2 iperf3 -s -1 -B 192.168.241.2 &
122
- waitiperf $netns2
121
+ waitiperf $netns2 $!
123
122
n1 iperf3 -Z -t 3 -c 192.168.241.2
124
123
125
124
# TCP over IPv6
126
125
n1 iperf3 -s -1 -B fd00::1 &
127
- waitiperf $netns1
126
+ waitiperf $netns1 $!
128
127
n2 iperf3 -Z -t 3 -c fd00::1
129
128
130
129
# UDP over IPv4
131
130
n1 iperf3 -s -1 -B 192.168.241.1 &
132
- waitiperf $netns1
131
+ waitiperf $netns1 $!
133
132
n2 iperf3 -Z -t 3 -b 0 -u -c 192.168.241.1
134
133
135
134
# UDP over IPv6
136
135
n2 iperf3 -s -1 -B fd00::2 &
137
- waitiperf $netns2
136
+ waitiperf $netns2 $!
138
137
n1 iperf3 -Z -t 3 -b 0 -u -c fd00::2
139
138
}
140
139
@@ -207,7 +206,7 @@ n1 ping -W 1 -c 1 192.168.241.2
207
206
n1 wg set wg0 peer " $pub2 " allowed-ips 192.168.241.0/24
208
207
exec 4< <( n1 ncat -l -u -p 1111)
209
208
ncat_pid=$!
210
- waitncatudp $netns1
209
+ waitncatudp $netns1 $ncat_pid
211
210
n2 ncat -u 192.168.241.1 1111 <<< " X"
212
211
read -r -N 1 -t 1 out < & 4 && [[ $out == " X" ]]
213
212
kill $ncat_pid
@@ -216,7 +215,7 @@ n1 wg set wg0 peer "$more_specific_key" allowed-ips 192.168.241.2/32
216
215
n2 wg set wg0 listen-port 9997
217
216
exec 4< <( n1 ncat -l -u -p 1111)
218
217
ncat_pid=$!
219
- waitncatudp $netns1
218
+ waitncatudp $netns1 $ncat_pid
220
219
n2 ncat -u 192.168.241.1 1111 <<< " X"
221
220
! read -r -N 1 -t 1 out < & 4 || false
222
221
kill $ncat_pid
@@ -516,6 +515,12 @@ n0 wg set wg0 peer "$pub2" allowed-ips 0.0.0.0/0,10.0.0.0/8,100.0.0.0/10,172.16.
516
515
n0 wg set wg0 peer " $pub2 " allowed-ips 0.0.0.0/0
517
516
n0 wg set wg0 peer " $pub2 " allowed-ips ::/0,1700::/111,5000::/4,e000::/37,9000::/75
518
517
n0 wg set wg0 peer " $pub2 " allowed-ips ::/0
518
+ n0 wg set wg0 peer " $pub2 " remove
519
+ low_order_points=( AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= 4Ot6fDtBuK4WVuP68Z/EatoJjeucMrH9hmIFFl9JuAA= X5yVvKNQjCSx0LFVnIPvWwREXMRYHI6G2CJO3dCfEVc= 7P///////////////////////////////////////38= 7f///////////////////////////////////////38= 7v///////////////////////////////////////38= )
520
+ n0 wg set wg0 private-key /dev/null ${low_order_points[@]/#/ peer }
521
+ [[ -z $( n0 wg show wg0 peers) ]]
522
+ n0 wg set wg0 private-key <( echo " $key1 " ) ${low_order_points[@]/#/ peer }
523
+ [[ -z $( n0 wg show wg0 peers) ]]
519
524
ip0 link del wg0
520
525
521
526
declare -A objects
0 commit comments