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

networking: Set networking.search to [domain] by default #94986

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kirelagin
Copy link
Member

@kirelagin kirelagin commented Aug 9, 2020

Motivation for this change

The net effect of this PR is that it allows setting networking.search = []. Please, see the commit message for details.

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.

Currently it is impossible to set `networking.search` to an empty list:
in this case the option will not appear in the config at all, which is
semantically different from having `search` with an empty list in
resolv.conf. There is a workaround – set `networking.search = ["."]`,
but it is not very obvious.

Change the logic of resolv.conf generation to always include the
`search` option and instead default it to `networking.domain` in the
NixOS module.

* For people who had `networking.search` unset, this will set it to the
  list consisting of their domain, which will result in `search
  <networking.domain>` being added to their `resolv.conf`, which is
  equivalent to having `search` option, i.e. the behaviour will not
  change.
* For people who set `networking.search` to a non-empty list exactly
  the same resolv.conf as before will be generated.
* For people who set `networking.search = []` previously this would
  have no effect, now it will actually result in the empty search list
  in their resolv.conf, which is, arguably, what they expect.
@kirelagin
Copy link
Member Author

cc @wkennington as the author and @7c6f434c as the merger of #2380.

@7c6f434c
Copy link
Member

I think empty networking.search was also possible before? You mean enabling putting an empty search line into resolv.conf?

@kirelagin
Copy link
Member Author

Yes, I mean, explicitly putting an empty search line into resolv.conf to disable the useless and actually harmful (imho) domain search list “feature”.

@kirelagin
Copy link
Member Author

Apparently, domain and search are mutually exclusive, so I should just remove domain at all. And also there is a suspicion that just adding a search line with an empty list is not enough to disable this behaviour, I’ll need to take a close look :/.

@SuperSandro2000
Copy link
Member

@kirelagin please resolve the merge conflict.

@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@wegank wegank marked this pull request as draft March 20, 2024 15:44
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.

None yet

3 participants