Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/avahi: fix nss module #99530

Merged
merged 1 commit into from Oct 11, 2020
Merged

nixos/avahi: fix nss module #99530

merged 1 commit into from Oct 11, 2020

Conversation

lopsided98
Copy link
Contributor

mdns_minimal must be placed before resolve in nsswitch.conf. This was broken by #86940 or #87016, when the config was split up into multiple modules and the ordering was lost. This PR uses mkOrder to restore the correct ordering.

This PR ends up placing mymachines between mdns_minimal and resolve, but I believe this is fine. My understanding of the problem is that resolve responds to all hostnames, so .local domains currently never make it to mdns_minimal. On the other hand, mdns_minimal only responds to .local domains and all other are passed on to the next module. So as long as a systemd container doesn't have a .local domain there shouldn't be a problem.

Fixes #98050.

cc @flokli

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

mdns_minimal must be placed before resolve in nsswitch.conf
Copy link
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me.

@arianvp
Copy link
Member

arianvp commented Oct 5, 2020

Hmm I need to give this a bit of thought, resolved/networkd has its own MDNS resolver built-in; and this will actually break when people want to use resolved's built-in support for resolving mDNS (which allows you to configure mDNS per interface using .network files).

If you don't explicitly disable the responder (by setting MulticastDNS=resolve or MulticastDNS=false) other things will break in combination with Avahi too I think.

@lopsided98 if you set MulticastDNS=false

Also see the notes about this in the Arch wiki : https://wiki.archlinux.org/index.php/Avahi

OTOH the arch wiki has the same order as you're proposing here; so this is probably fine?

@lopsided98
Copy link
Contributor Author

lopsided98 commented Oct 5, 2020

I don't think resolved's mDNS support is on by default, is it? The per-link setting defaults to off. I have Avahi enabled without touching resolved's settings and it works fine.

In any case, this PR just means that Avahi will preferred over resolved for mDNS resolution if both are enabled.

@bjornfor bjornfor merged commit 8294af0 into NixOS:master Oct 11, 2020
flokli added a commit that referenced this pull request Oct 11, 2020
This allows testing avahi works with resolved being enabled, as a
regression test for #99530.
@lopsided98 lopsided98 deleted the avahi-nss branch October 11, 2020 18:51
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-make-systemd-resolved-and-mdns-work-together/10910/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mdns support for nss does not work when networkd is enabled
5 participants