wireguard.lists.zx2c4.com archive mirror
 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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wg-quick: Unset the DNS first, then delete the WireGuard interface.
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Jason A. Donenfeld @ 2019-03-20 22:55 UTC (permalink / raw)
  To: Colin Finck; +Cc: WireGuard mailing list

Hey Colin,

On Wed, Mar 20, 2019 at 4:46 PM Colin Finck <mail@colinfinck.de> wrote:
>
> This prevents an "Unknown interface 'wg0': No such device" error on the command line.

Your patch seems basic and reasonable enough. However, I don't know
how to reproduce the error you're getting. Usually resolvconf doesn't
care if the interface is there or not. What OS/configuration is this
for you?

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

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

* Re: [PATCH] wg-quick: Unset the DNS first, then delete the WireGuard interface.
  2019-03-20 22:55 ` Jason A. Donenfeld
@ 2019-03-21  7:32   ` Colin Finck
  0 siblings, 0 replies; 3+ messages in thread
From: Colin Finck @ 2019-03-21  7:32 UTC (permalink / raw)
  To: Jason A. Donenfeld; +Cc: WireGuard mailing list


[-- Attachment #1.1.1: Type: text/plain, Size: 447 bytes --]

Hi Jason,

Am 20.03.2019 um 23:55 schrieb Jason A. Donenfeld:
> Your patch seems basic and reasonable enough. However, I don't know
> how to reproduce the error you're getting. Usually resolvconf doesn't
> care if the interface is there or not. What OS/configuration is this
> for you?

This is resolvconf from systemd-resolved, running on a custom Linux with
kernel 4.14.x.
"resolvconf --version" reports "systemd 239".


- Colin


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
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).