From ce55f857ffff12a57d072991a0ec6625829f614f Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 17 May 2019 12:32:46 +0200 Subject: [PATCH] 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 --- src/wg-quick/linux.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash index 5eaa504..8f1812c 100755 --- a/src/wg-quick/linux.bash +++ b/src/wg-quick/linux.bash @@ -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 }