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 1 commit into from Oct 11, 2020

nixos/avahi: fix nss module #99530

merged 1 commit into from Oct 11, 2020


Copy link

@lopsided98 lopsided98 commented Oct 4, 2020

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
mdns_minimal must be placed before resolve in nsswitch.conf
Copy link

@doronbehar doronbehar left a comment

Works for me.

Copy link

@arianvp 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 :

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

Copy link
Contributor Author

@lopsided98 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
16 checks passed
flokli added a commit that referenced this issue 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 Oct 11, 2020
Copy link

@nixos-discourse nixos-discourse commented Apr 3, 2021

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

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

Successfully merging this pull request may close these issues.

5 participants