diff mbox series

[2/2] doc: document global MulticastDNS option

Message ID 20221103105639.8289-2-andrea@pappacoda.it (mailing list archive)
State New
Headers show
Series [1/2] netconfig: add global MulticastDNS option | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Andrea Pappacoda Nov. 3, 2022, 10:56 a.m. UTC
Documents the new MulticastDNS global option, also adding some more
details regarding how and when systemd-resolved enables mDNS, and how
iwd handles it.
---
See <https://lore.kernel.org/iwd/A4TIKR.5DC9OCNE90W6@pappacoda.it/T/>
for more context.

 doc/main.conf       |  6 ++++++
 src/iwd.config.rst  | 19 +++++++++++++++++++
 src/iwd.network.rst |  4 ++--
 3 files changed, 27 insertions(+), 2 deletions(-)

Comments

Denis Kenzior Nov. 3, 2022, 7:21 p.m. UTC | #1
Hi Andrea,

On 11/3/22 05:56, Andrea Pappacoda wrote:
> Documents the new MulticastDNS global option, also adding some more
> details regarding how and when systemd-resolved enables mDNS, and how
> iwd handles it.
> ---
> See <https://lore.kernel.org/iwd/A4TIKR.5DC9OCNE90W6@pappacoda.it/T/>
> for more context.
> 
>   doc/main.conf       |  6 ++++++
>   src/iwd.config.rst  | 19 +++++++++++++++++++
>   src/iwd.network.rst |  4 ++--
>   3 files changed, 27 insertions(+), 2 deletions(-)
> 
So overall I don't mind doing this if there's no other way, but I do wonder... 
According to [1]:

"The SetLinkLLMNR() method enables or disables LLMNR support on a specific 
network interface. It takes a network interface index as well as a string that 
may either be empty or one of "yes", "no" or "resolve". If empty, the 
systemd-wide default LLMNR setting is used. If "yes", LLMNR is used for 
resolution of single-label names and the local hostname is registered on all 
local LANs for LLMNR resolution by peers. If "no", LLMNR is turned off fully on 
this interface. If "resolve", LLMNR is only enabled for resolving names, but the 
local hostname is not registered for other peers to use.

Similarly, the SetLinkMulticastDNS() method enables or disables MulticastDNS 
support on a specific interface. It takes the same parameters as SetLinkLLMNR() 
described above."

Right now, if no setting is provided, then we do not invoke 
SetLinkMulticastDNS() at all.  If we were to send SetLinkMulticastDNS() with an 
empty string, would it just apply the global resolved defaults?  In which case, 
should we simply default to using an empty string if the setting isn't provided?

[1] https://www.freedesktop.org/software/systemd/man/org.freedesktop.resolve1.html

Regards,
-Denis
Andrea Pappacoda Nov. 3, 2022, 9:31 p.m. UTC | #2
Hi Denis, thanks for your feedback :)

Il giorno gio 3 nov 2022 alle 14:21:28 -05:00:00, Denis Kenzior 
<denkenz@gmail.com> ha scritto:
> Right now, if no setting is provided, then we do not invoke 
> SetLinkMulticastDNS() at all.  If we were to send 
> SetLinkMulticastDNS() with an empty string, would it just apply the 
> global resolved defaults?  In which case, should we simply default to 
> using an empty string if the setting isn't provided?

Unfortunately I don't know much about D-Bus, but I took a quick look at 
systemd-resolved's source and it seems that this wouldn't work.

As far as I understand, when no link-specific value is provided on the 
D-Bus interface, resolved sets LLMNR to "yes"[1] and mDNS to "no"[2]. 
It is possible that I have misinterpreted the code though, so checking 
if this is actually the case could still be worth it.

[1]: 
https://github.com/systemd/systemd/blob/6c83054c0133eb53245e479d71589dceff76cf74/src/resolve/resolved-link-bus.c#L514-L515

[2]: 
https://github.com/systemd/systemd/blob/6c83054c0133eb53245e479d71589dceff76cf74/src/resolve/resolved-link-bus.c#L562-L563
Andrea Pappacoda Nov. 3, 2022, 9:58 p.m. UTC | #3
Hi again,

Il giorno gio 3 nov 2022 alle 22:31:53 +01:00:00, Andrea Pappacoda 
<andrea@pappacoda.it> ha scritto:
> As far as I understand, when no link-specific value is provided on 
> the D-Bus interface, resolved sets LLMNR to "yes"[1] and mDNS to 
> "no"[2]. It is possible that I have misinterpreted the code though, 
> so checking if this is actually the case could still be worth it.

Thinking about this more, I'm starting to see this as a bug in 
systemd-resolved. I've reported it on 
<https://github.com/systemd/systemd/issues/25252>.

For the time being, it may be better not to merge this.
James Prestwood Nov. 3, 2022, 10:05 p.m. UTC | #4
On Thu, 2022-11-03 at 22:58 +0100, Andrea Pappacoda wrote:
> Hi again,
> 
> Il giorno gio 3 nov 2022 alle 22:31:53 +01:00:00, Andrea Pappacoda 
> <andrea@pappacoda.it> ha scritto:
> > As far as I understand, when no link-specific value is provided on 
> > the D-Bus interface, resolved sets LLMNR to "yes"[1] and mDNS to 
> > "no"[2]. It is possible that I have misinterpreted the code though,
> > so checking if this is actually the case could still be worth it.
> 
> Thinking about this more, I'm starting to see this as a bug in 
> systemd-resolved. I've reported it on 
> <https://github.com/systemd/systemd/issues/25252>.
> 
> For the time being, it may be better not to merge this.

In addition the documentation about calling with an empty string
doesn't appear to be true either. If I set main.conf:

[Network]
MulticastDNS=


And modify the logic to allow "" I both don't see +mDNS on my per-link
setting, nor do I see any mDNS packets.

So I guess we see what systemd says, I'll also comment on that bug
report about the empty string issue. Maybe you could try this out as
well to make sure I'm not crazy.

Thanks,
James
diff mbox series

Patch

diff --git a/doc/main.conf b/doc/main.conf
index e85aab10..f49d27db 100644
--- a/doc/main.conf
+++ b/doc/main.conf
@@ -37,6 +37,12 @@ 
 #
 #NameResolvingService=resolvconf
 #
+# If NameResolvingService=systemd is set, iwd can tell systemd-resolved to
+# enable multicast DNS for a given interface. Uncomment the value below to
+# enable mDNS for all the interfaces:
+#
+#MulticastDNS=true
+#
 # iwd's support for IPv6 is still experimental and is disabled by default.
 # If you want to try it anyway, uncomment the setting below.  Note that
 # configuration via SLAAC is currently not supported (DHCPv6 only).
diff --git a/src/iwd.config.rst b/src/iwd.config.rst
index bafb6b85..27433cb1 100644
--- a/src/iwd.config.rst
+++ b/src/iwd.config.rst
@@ -249,6 +249,25 @@  The group ``[Network]`` contains network configuration related settings.
        If ``none`` is specified, then DNS and domain name information is
        ignored.
 
+   * - MulticastDNS
+     - Values: true, false, resolve
+
+       When ``NameResolvingService`` is set to ``systemd``, **iwd** can tell
+       **systemd-resolved** to enable multicast DNS for a given interface.
+       This setting configures the default for all the interfaces.
+
+       If ``EnableNetworkConfiguration`` is enabled and no other network
+       manager is configured, mDNS will be completely governed by this
+       option, assuming that MulticastDNS is enabled in ``resolved.conf``.
+
+       Note that individual network profiles can override this global value;
+       also see ``man 5 iwd.network``.
+
+       When no value is set, systemd-resolved's per-link setting will remain
+       untouched.
+
+       See ``man 5 resolved.conf`` for details.
+
    * - RoutePriorityOffset
      - Values: uint32 value (default: **300**)
 
diff --git a/src/iwd.network.rst b/src/iwd.network.rst
index d3692834..4a207514 100644
--- a/src/iwd.network.rst
+++ b/src/iwd.network.rst
@@ -330,8 +330,8 @@  file.
      - Values: true, false, resolve
 
        Configures multicast DNS for this network. If not specified,
-       systemd-resolved's default value will remain untouched.
-       See ``man 5 systemd.network`` for details.
+       the global iwd default will be used instead.
+       See ``man 5 iwd.config`` for details.
 
        Only applies when ``NameResolvingService=systemd``.