From cbd2b0531f116c286dd6fffcac78f1af57717037 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 1 Oct 2017 21:42:32 +0200 Subject: [PATCH] wg-quick: verify wireguard interface in more clever way This helps with old Debian which has ancient iproute2, as well as paving the path toward this script supporting userspace implementations. Signed-off-by: Jason A. Donenfeld --- src/wg-quick.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wg-quick.bash b/src/wg-quick.bash index c70c078..5295c8b 100755 --- a/src/wg-quick.bash +++ b/src/wg-quick.bash @@ -249,7 +249,7 @@ cmd_up() { } cmd_down() { - [[ -n $(ip link show dev "$INTERFACE" type wireguard 2>/dev/null) ]] || die "\`$INTERFACE' is not a WireGuard interface" + [[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface" execute_hook "$PRE_DOWN" [[ $SAVE_CONFIG -eq 0 ]] || save_config unset_dns