Message ID | 20221103105639.8289-1-andrea@pappacoda.it (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/2] netconfig: add global MulticastDNS option | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
prestwoj/iwd-alpine-ci-fetch | success | Fetch PR |
prestwoj/iwd-ci-gitlint | success | GitLint |
prestwoj/iwd-ci-fetch | success | Fetch PR |
prestwoj/iwd-alpine-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-alpine-ci-build | success | Build - Configure |
prestwoj/iwd-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-ci-build | success | Build - Configure |
prestwoj/iwd-alpine-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-alpine-ci-makecheck | success | Make Check |
prestwoj/iwd-alpine-ci-incremental_build | success | Incremental Build with patches |
prestwoj/iwd-ci-clang | success | clang PASS |
prestwoj/iwd-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-ci-makecheck | success | Make Check |
prestwoj/iwd-ci-incremental_build | success | Incremental Build with patches |
prestwoj/iwd-ci-testrunner | success | test-runner PASS |
> Adds the MulticastDNS option globally to main.conf. If set all > network connections (when netconfig is enabled) will set mDNS > support into the resolver. Note that an individual network profile > can still override the global value if it sets MulticastDNS. Since we're getting a global setting for mDNS, would it make sense to add a global setting for DNS at the same time too?
Il giorno gio 3 nov 2022 alle 14:23:57 +00:00:00, Rhys Perry <rhysperry111@gmail.com> ha scritto: > Since we're getting a global setting for mDNS, would it make sense to > add a global setting for DNS at the same time too? I'm not sure about this. Setting a default system-wide DNS server is already possible by other means (by editing /etc/resolve.conf, modifying systemd-resolved options, etc.). Also, overriding the DNS server received via DHCP can create issues, and I wouldn't feel comfortable in enabling such a setting for all of my networks. Lastly, I believe that having a global MulticastDNS option makes sense because the network manager is the only entity that can tell sd-resolved to use mDNS on a given link.
On Thu, 3 Nov 2022 at 15:48, Andrea Pappacoda <andrea@pappacoda.it> wrote: > > Il giorno gio 3 nov 2022 alle 14:23:57 +00:00:00, Rhys Perry > <rhysperry111@gmail.com> ha scritto: > > Since we're getting a global setting for mDNS, would it make sense to > > add a global setting for DNS at the same time too? > > I'm not sure about this. Setting a default system-wide DNS server is > already possible by other means (by editing /etc/resolve.conf, > modifying systemd-resolved options, etc.). This doesn't seem to work, as systemd-resolved will let the DNS server passed from IWD have precedence over its configured default server. systemd-resolved can take over /etc/resolve.conf (with its own stub) > Also, overriding the DNS > server received via DHCP can create issues, and I wouldn't feel > comfortable in enabling such a setting for all of my networks. Fair enough, although I feel some users like myself, who quite often connect to untrusted networks, would like the option to be able to avoid blindly trusting the DNS server provided through DHCP (without having to manually configure the setting for new networks they join and don't trust). I would certainly prefer to be able to set a global DNS, and then override that in the cases that it causes problems (e.g. captive portals).
On Thu, 2022-11-03 at 15:56 +0000, Rhys Perry wrote: > On Thu, 3 Nov 2022 at 15:48, Andrea Pappacoda <andrea@pappacoda.it> > wrote: > > > > Il giorno gio 3 nov 2022 alle 14:23:57 +00:00:00, Rhys Perry > > <rhysperry111@gmail.com> ha scritto: > > > Since we're getting a global setting for mDNS, would it make > > > sense to > > > add a global setting for DNS at the same time too? > > > > I'm not sure about this. Setting a default system-wide DNS server > > is > > already possible by other means (by editing /etc/resolve.conf, > > modifying systemd-resolved options, etc.). > > This doesn't seem to work, as systemd-resolved will let the DNS > server > passed from IWD have precedence over its configured default server. > systemd-resolved can take over /etc/resolve.conf (with its own stub) Couldn't you set [Network].NameResolvingService=none in main.conf to work around this? > > > Also, overriding the DNS > > server received via DHCP can create issues, and I wouldn't feel > > comfortable in enabling such a setting for all of my networks. > > Fair enough, although I feel some users like myself, who quite often > connect to untrusted networks, would like the option to be able to > avoid blindly trusting the DNS server provided through DHCP (without > having to manually configure the setting for new networks they join > and don't trust). I would certainly prefer to be able to set a global > DNS, and then override that in the cases that it causes problems > (e.g. > captive portals).
diff --git a/src/netconfig.c b/src/netconfig.c index e6779d7c..8b798e0b 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -56,6 +56,7 @@ */ static uint32_t ROUTE_PRIORITY_OFFSET; static bool ipv6_enabled; +static char *mdns_global; static void do_debug(const char *str, void *user_data) { @@ -396,13 +397,16 @@ send_hostname: } mdns: - if (l_settings_has_key(active_settings, "Network", "MulticastDNS") && - !(mdns = l_settings_get_string(active_settings, - "Network", - "MulticastDNS"))) { - l_error("netconfig: Can't load Network.MulticastDNS"); - success = false; - } + /* If the networks has this set take that over the global */ + if (l_settings_has_key(active_settings, "Network", "MulticastDNS")) { + mdns = l_settings_get_string(active_settings, "Network", + "MulticastDNS"); + if (!mdns) { + l_error("netconfig: Can't load Network.MulticastDNS"); + success = false; + } + } else if (mdns_global) + mdns = l_strdup(mdns_global); if (mdns && !L_IN_STRSET(mdns, "true", "false", "resolve")) { l_error("netconfig: Bad Network.MulticastDNS value '%s'", mdns); @@ -753,11 +757,15 @@ static int netconfig_init(void) &ipv6_enabled)) ipv6_enabled = false; + mdns_global = l_settings_get_string(iwd_get_config(), "Network", + "MulticastDNS"); + return 0; } static void netconfig_exit(void) { + l_free(mdns_global); } IWD_MODULE(netconfig, netconfig_init, netconfig_exit)
From: James Prestwood <prestwoj@gmail.com> Adds the MulticastDNS option globally to main.conf. If set all network connections (when netconfig is enabled) will set mDNS support into the resolver. Note that an individual network profile can still override the global value if it sets MulticastDNS. --- src/netconfig.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)