]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: look up existing routes properly
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 17 May 2019 10:32:46 +0000 (12:32 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 28 May 2019 23:23:24 +0000 (01:23 +0200)
This was never really correct, and then 5.1 broke it entirely.

Reported-by: piraty1@inbox.ru
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/linux.bash

index 5eaa5042aabde8bc60d388cfd8e45aaec9b58e9a..8f1812c1ccdb902616261f0632c16a42e665066d 100755 (executable)
@@ -164,7 +164,7 @@ add_route() {
        elif [[ $1 == */0 ]]; then
                add_default "$1"
        else
-               [[ $(ip route get "$1" 2>/dev/null) == *dev\ $INTERFACE\ * ]] || cmd ip route add "$1" dev "$INTERFACE"
+               [[ -n $(ip route show dev "$INTERFACE" match "$1" 2>/dev/null) ]] || cmd ip route add "$1" dev "$INTERFACE"
        fi
 }