iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Andrea Pappacoda <andrea@pappacoda.it>
To: James Prestwood <prestwoj@gmail.com>
Cc: iwd@lists.linux.dev
Subject: Re: MulticastDNS for all connections
Date: Wed, 02 Nov 2022 21:23:36 +0100	[thread overview]
Message-ID: <CZLQKR.DUWHOW09XS8D@pappacoda.it> (raw)
In-Reply-To: <66b9f15578d9f7112e532a7174268b02b629360f.camel@gmail.com>

Hi James, thanks for your reply :)

Il giorno mar 1 nov 2022 alle 13:54:36 -07:00:00, James Prestwood 
<prestwoj@gmail.com> ha scritto:
> Currently the MulticastDNS option is only per-network, but systemd-
> resolved has a global setting itself according to the docs [1].
> 
> But I actually wonder if event setting MulticastDNS in IWD is doing
> anything:
> 
> "Multicast DNS will be enabled on a link only if the per-link and the
> global setting is on."
> 
> This would imply you need to set /etc/systemd/resolved.conf with
> MulticastDNS=true to even use mDNS at all? Or maybe you have already
> done this? And I see the problem, per-link settings are only in
> systemd-networkd, which you don't use...

Yes, MulticastDNS needs to be enabled globally in resolved.conf (it is 
enabled by default) and also be enabled by whoever is managing the 
network interface.

Enabling mDNS in specific networks by adding MulticastDNS=true in 
/var/lib/iwd/network-name works as expected.

> Like I said, I don't know much about mDNS but would a global option
> 'break' networks which don't support mDNS? Are you frequently
> connecting to many networks and needed to add this option to the
> profile each time?

I used to have mDNS globally enabled in NetworkManager, and it never 
created issues. As far as I understand, enabling mDNS simply allows you 
do to Multicast DNS queries on that network; it shouldn't interfere 
with non-multicast queries. I use mDNS every once in a while (on three 
different networks since last week), so I'd like to simply enable the 
global setting and forget about it.

> The fact that this depends on setting systemd-resolved's global option
> and the per-link option I would say this really should stay in 
> systemd-
> * itself. The IWD setting is kinda useless without the global option
> anyways. Plus systemd-networkd is much more flexible, you can match
> based on all kinds of things where IWD is very rigid (global or per-
> network).

iwd has an option that enables it to replace other network managers for 
simple use cases, EnableNetworkConfiguration=true, so it seems 
reasonable for somebody to not have any other connection manager 
installed, and for those use cases I'd say that iwd's coarseness is 
fine. I've applied a quick and dirty patch on top of version 1.30, and 
it seems to work without issues; mdns_global probably leaks, but this 
can't be applied on master anyway and I was just trying to figure out 
how easy it would be to add this feature.

diff --git a/src/netconfig.c b/src/netconfig.c
index 4a70b0ca..3e3c36a9 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -95,6 +95,7 @@ static struct l_queue *netconfig_list;
  */
 static uint32_t ROUTE_PRIORITY_OFFSET;
 static bool ipv6_enabled;
+static char* mdns_global;

 static void do_debug(const char *str, void *user_data)
 {
@@ -1432,6 +1433,11 @@ bool netconfig_load_settings(struct netconfig 
*netconfig,

 	mdns = l_settings_get_string(active_settings,
 					"Network", "MulticastDNS");
+	if (!mdns) {
+		const size_t mdns_global_size = strlen(mdns_global) + 1;
+		mdns = malloc(mdns_global_size);
+		memcpy(mdns, mdns_global, mdns_global_size);
+	}

 	if (l_settings_has_key(active_settings, "IPv4", "Address")) {
 		v4_address = netconfig_get_static4_address(active_settings);
@@ -1757,6 +1763,8 @@ static int netconfig_init(void)
 					&ipv6_enabled))
 		ipv6_enabled = false;

+	mdns_global = l_settings_get_string(iwd_get_config(), "Network", 
"MulticastDNS");
+
 	netconfig_list = l_queue_new();

 	return 0;



  reply	other threads:[~2022-11-02 20:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29 15:16 MulticastDNS for all connections Andrea Pappacoda
2022-11-01 20:54 ` James Prestwood
2022-11-02 20:23   ` Andrea Pappacoda [this message]
2022-11-02 20:47     ` James Prestwood
2022-11-02 21:55       ` Andrea Pappacoda
2022-11-02 22:06         ` James Prestwood

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=CZLQKR.DUWHOW09XS8D@pappacoda.it \
    --to=andrea@pappacoda.it \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.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).