MacOS app update needed

Ken Case kc at omnigroup.com
Sat Sep 24 01:28:21 UTC 2022


> On Sep 22, 2022, at 04:48, Jason A. Donenfeld <Jason at zx2c4.com> wrote:
> 
> On Wed, Sep 21, 2022 at 9:31 AM Simon Karberg <simon.karberg at agillic.com> wrote:
>> 
>> Hi,
>> 
>> I've been testing the Domain Search functionality on all 3 OS'
>> (Windows, Mac & Linux) and the setting:
>> 
>> DNS=<dns server>, <search domains>
>> Is only being applied on Windows & Linux.
>> 
>> Further testing on MacOS I've found that the homebrew installation works.
>> wiregurd-go is version 0.0.20220316 and wireguard-tools is version 1.0.20210914
>> 
>> The App Store app is version:
>> App: 1.0.15 (26)
>> Go backend: 2ef39d47
> 
> Huh, that's surprising. This was added a few years ago with 9231c035
> ("global: support DNS search domains"), so it definitely *should* be
> supported. Might be a bug with the network config from
> PacketTunnelSettingsGenerator. I'll look into this when circling back
> to wireguard-apple development. Thanks for mentioning it.
> 
> Jason
> 

Oh, I have a pretty simple patch that fixes this bug that I've been running locally for months. I keep meaning to figure out the right place to send it, but keep not having time to look up where that is. Patch included below, anyone is welcome to use it (attributed or not) or to direct me to send it somewhere else!

				Cheers,
				Ken

---

Subject: [PATCH] Qualify routed DNS queries based on search domains.

Rather than unconditionally routing all DNS queries through the
associated tunnel's DNS, only route queries when no search domains
have been specified. When search domains _have_ been specified, route
those domains to the tunnel's DNS but let other domains continue to be
routed to other network interfaces.
---
Sources/WireGuardKit/PacketTunnelSettingsGenerator.swift | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Sources/WireGuardKit/PacketTunnelSettingsGenerator.swift b/Sources/WireGuardKit/PacketTunnelSettingsGenerator.swift
index c53a82c..5b7f63c 100644
--- a/Sources/WireGuardKit/PacketTunnelSettingsGenerator.swift
+++ b/Sources/WireGuardKit/PacketTunnelSettingsGenerator.swift
@@ -88,7 +88,13 @@ class PacketTunnelSettingsGenerator {
            let dnsSettings = NEDNSSettings(servers: dnsServerStrings)
            dnsSettings.searchDomains = tunnelConfiguration.interface.dnsSearch
            if !tunnelConfiguration.interface.dns.isEmpty {
-                dnsSettings.matchDomains = [""] // All DNS queries must first go through the tunnel's DNS
+                if tunnelConfiguration.interface.dnsSearch.isEmpty {
+                    // Since no search domains were listed, use this tunnel's DNS for all queries
+                    dnsSettings.matchDomains = [""]
+                } else {
+                    // Only use this tunnel for the listed search domains
+                    dnsSettings.matchDomains = tunnelConfiguration.interface.dnsSearch
+                }
            }
            networkSettings.dnsSettings = dnsSettings
        }
--  2.37.0 (Apple Git-136)



More information about the WireGuard mailing list