wg-quick: look up existing routes properly

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>
This commit is contained in:
Jason A. Donenfeld 2019-05-17 12:32:46 +02:00
parent c2355e00aa
commit ce55f857ff
1 changed files with 1 additions and 1 deletions

View File

@ -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
}