Development discussion of WireGuard
 help / color / mirror / Atom feed
From: "Coşku Baş" <cosku.bas@gmail.com>
To: wireguard@lists.zx2c4.com
Subject: [PATCH] darwin wg-quick dns reset
Date: Wed, 20 Mar 2019 09:53:16 +0300	[thread overview]
Message-ID: <CAAvxC942GC6EBFCnVyLJN6YHW01iMmP7h6c45Nr0Sq4xoq2hyQ@mail.gmail.com> (raw)


[-- 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

                 reply	other threads:[~2019-03-20 22:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAvxC942GC6EBFCnVyLJN6YHW01iMmP7h6c45Nr0Sq4xoq2hyQ@mail.gmail.com \
    --to=cosku.bas@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).