From: Jason A. Donenfeld Date: Sun, 1 Oct 2017 19:42:32 +0000 (+0200) Subject: wg-quick: verify wireguard interface in more clever way X-Git-Tag: v1.0.20191226~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbd2b0531f116c286dd6fffcac78f1af57717037;p=thirdparty%2Fwireguard-tools.git 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 --- 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