aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-11 23:39:17 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-06-11 23:39:17 +0200
commit1b5234f3d59f2bca0c2d49600979d856229ba781 (patch)
tree5bce6a828198fb89b414c6a8e214b2fb20262561 /src
parentexternal-tests: trim the fat (diff)
downloadwireguard-tools-1b5234f3d59f2bca0c2d49600979d856229ba781.tar.xz
wireguard-tools-1b5234f3d59f2bca0c2d49600979d856229ba781.zip
wg-quick: make sure we have empty table for both v6 and v4
Otherwise, we wind up not doing the right thing in the v6-only case, or doing something totally borked when v4 and v6 are filled unevenly. Reported-by: Roelf Wichertjes <contact@roelf.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wg-quick.bash4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wg-quick.bash b/src/wg-quick.bash
index a4f349a..75050fd 100755
--- a/src/wg-quick.bash
+++ b/src/wg-quick.bash
@@ -141,7 +141,9 @@ DEFAULT_TABLE=
add_default() {
if [[ -z $DEFAULT_TABLE ]]; then
DEFAULT_TABLE=51820
- while [[ -n $(ip route show table $DEFAULT_TABLE) ]]; do ((DEFAULT_TABLE++)); done
+ while [[ -n $(ip -4 route show table $DEFAULT_TABLE) || -n $(ip -6 route show table $DEFAULT_TABLE) ]]; do
+ ((DEFAULT_TABLE++))
+ done
fi
local proto=-4 src ip
if [[ $1 == *:* ]]; then