]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: verify wireguard interface in more clever way
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 1 Oct 2017 19:42:32 +0000 (21:42 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 2 Oct 2017 00:45:53 +0000 (02:45 +0200)
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 <Jason@zx2c4.com>
src/wg-quick.bash

index c70c0789ff47bc9967b6fc6406d6540c39ac25de..5295c8bfff65ca0a886d40e60dfc1bc4bbfa8889 100755 (executable)
@@ -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