aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests/netns.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-08-08 19:18:25 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-09 01:22:05 -0700
commit86a61df7bcad022f22afdd169e147155b89f8d85 (patch)
treeaa767e20ba83768eda569053d4900072438e385e /src/tests/netns.sh
parenttimers: include header in right file (diff)
downloadwireguard-monolithic-historical-86a61df7bcad022f22afdd169e147155b89f8d85.tar.xz
wireguard-monolithic-historical-86a61df7bcad022f22afdd169e147155b89f8d85.zip
netlink: don't start over iteration on multipart non-first allowedips
Reported-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to '')
-rwxr-xr-xsrc/tests/netns.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/netns.sh b/src/tests/netns.sh
index d1950a0..29e1fd4 100755
--- a/src/tests/netns.sh
+++ b/src/tests/netns.sh
@@ -439,6 +439,30 @@ n0 wg setconf wg0 <(printf '%s\n' "${config[@]}")
n0 wg showconf wg0 > /dev/null
ip0 link del wg0
+allowedips=( )
+for i in {1..197}; do
+ allowedips+=( abcd::$i )
+done
+saved_ifs="$IFS"
+IFS=,
+allowedips="${allowedips[*]}"
+IFS="$saved_ifs"
+ip0 link add wg0 type wireguard
+n0 wg set wg0 peer "$pub1"
+n0 wg set wg0 peer "$pub2" allowed-ips "$allowedips"
+{
+ read -r pub allowedips
+ [[ $pub == "$pub1" && $allowedips == "(none)" ]]
+ read -r pub allowedips
+ [[ $pub == "$pub2" ]]
+ i=0
+ for _ in $allowedips; do
+ ((++i))
+ done
+ ((i == 197))
+} < <(n0 wg show wg0 allowed-ips)
+ip0 link del wg0
+
! n0 wg show doesnotexist || false
ip0 link add wg0 type wireguard