Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH] wg-quick: Unset the DNS first, then delete the WireGuard interface.
@ 2019-03-14 11:56 Colin Finck
  2019-03-20 22:55 ` Jason A. Donenfeld
  0 siblings, 1 reply; 3+ messages in thread
From: Colin Finck @ 2019-03-14 11:56 UTC (permalink / raw)
  To: wireguard

This prevents an "Unknown interface 'wg0': No such device" error on the command line.

Signed-off-by: Colin Finck <mail@colinfinck.de>
---
 src/tools/wg-quick/freebsd.bash | 2 +-
 src/tools/wg-quick/linux.bash   | 2 +-
 src/tools/wg-quick/openbsd.bash | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/tools/wg-quick/freebsd.bash b/src/tools/wg-quick/freebsd.bash
index e83dbef..3b2d95b 100755
--- a/src/tools/wg-quick/freebsd.bash
+++ b/src/tools/wg-quick/freebsd.bash
@@ -420,8 +420,8 @@ cmd_down() {
 	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
 	execute_hooks "${PRE_DOWN[@]}"
 	[[ $SAVE_CONFIG -eq 0 ]] || save_config
-	del_if
 	unset_dns
+	del_if
 	execute_hooks "${POST_DOWN[@]}"
 }
 
diff --git a/src/tools/wg-quick/linux.bash b/src/tools/wg-quick/linux.bash
index 84643c4..d3d4fb0 100755
--- a/src/tools/wg-quick/linux.bash
+++ b/src/tools/wg-quick/linux.bash
@@ -295,8 +295,8 @@ cmd_down() {
 	[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
 	execute_hooks "${PRE_DOWN[@]}"
 	[[ $SAVE_CONFIG -eq 0 ]] || save_config
-	del_if
 	unset_dns
+	del_if
 	execute_hooks "${POST_DOWN[@]}"
 }
 
diff --git a/src/tools/wg-quick/openbsd.bash b/src/tools/wg-quick/openbsd.bash
index 9996162..d701ae1 100755
--- a/src/tools/wg-quick/openbsd.bash
+++ b/src/tools/wg-quick/openbsd.bash
@@ -414,8 +414,8 @@ cmd_down() {
 	fi
 	execute_hooks "${PRE_DOWN[@]}"
 	[[ $SAVE_CONFIG -eq 0 ]] || save_config
-	del_if
 	unset_dns
+	del_if
 	execute_hooks "${POST_DOWN[@]}"
 }
 
-- 
2.17.1.windows.2

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-23  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 11:56 [PATCH] wg-quick: Unset the DNS first, then delete the WireGuard interface Colin Finck
2019-03-20 22:55 ` Jason A. Donenfeld
2019-03-21  7:32   ` Colin Finck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).