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 <Jason@zx2c4.com>
This commit is contained in:
parent
a566bde126
commit
cbd2b0531f
|
@ -249,7 +249,7 @@ cmd_up() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_down() {
|
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"
|
execute_hook "$PRE_DOWN"
|
||||||
[[ $SAVE_CONFIG -eq 0 ]] || save_config
|
[[ $SAVE_CONFIG -eq 0 ]] || save_config
|
||||||
unset_dns
|
unset_dns
|
||||||
|
|
Loading…
Reference in a new issue