[PATCH] darwin wg-quick dns reset

Coşku Baş cosku.bas at gmail.com
Wed Mar 20 07:53:16 CET 2019


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[@]}"
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/wireguard/attachments/20190320/2fda819a/attachment.html>


More information about the WireGuard mailing list