wireguard.lists.zx2c4.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] darwin wg-quick dns reset
@ 2019-03-20  6:53 Coşku Baş
  0 siblings, 0 replies; only message in thread
From: Coşku Baş @ 2019-03-20  6:53 UTC (permalink / raw)
  To: wireguard


[-- Attachment #1.1: Type: text/plain, Size: 997 bytes --]

While fiddling with wg-quick on macos, I've noticed that the DNS settings
coming from the configuration file persists after calling wg-quick down on
the same config. I'm guessing this is not the intended behaviour. If it is
please ignore the patch.
----
diff --git a/src/tools/wg-quick/darwin.bash b/src/tools/wg-quick/darwin.bash
index aa3edeb..ef68bc4 100755
--- a/src/tools/wg-quick/darwin.bash
+++ b/src/tools/wg-quick/darwin.bash
@@ -280,11 +280,12 @@ set_dns() {
 }

 del_dns() {
+ collect_new_service_dns
  local service response
  for service in "${!SERVICE_DNS[@]}"; do
  while read -r response; do
  [[ $response == *Error* ]] && echo "$response" >&2
- done < <(cmd networksetup -setdnsservers "$service"
${SERVICE_DNS["$service"]} || true)
+ done < <(cmd networksetup -setdnsservers "$service" "Empty" || true)
  done
 }

@@ -442,6 +443,7 @@ cmd_down() {
  execute_hooks "${PRE_DOWN[@]}"
  [[ $SAVE_CONFIG -eq 0 ]] || save_config
  del_if
+ del_dns
  execute_hooks "${POST_DOWN[@]}"
 }

[-- Attachment #1.2: Type: text/html, Size: 1937 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 related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-20 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20  6:53 [PATCH] darwin wg-quick dns reset Coşku Baş

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