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/networkd: Add support for networking.defaultGateway.interface with networking.useNetworkd #93598

Closed

Conversation

duairc
Copy link
Contributor

@duairc duairc commented Jul 21, 2020

Motivation for this change

I'm not sure if there's a good reason why this was specifically disallowed, but it seems quite easy to make it work. I get the impression that there's a vague intention to deprecate the network.defaultGateway* options in the future, which I would be in favour of, but until that happens I don't see why there should be a divergence between useNetworkd being true or false. The reason I care about is this is that I'm writing a NixOS module that tries to abstract out the network configuration on a specific hosting provider, and with this change it can be independent of useNetworkd being enabled or not, which seems better for modularity.

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.

@stale
Copy link

stale bot commented Jun 26, 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 Jun 26, 2021
@duairc duairc force-pushed the systemd-networkd-gateway-interface branch from 0163625 to df6ad01 Compare April 6, 2022 19:06
@duairc duairc force-pushed the systemd-networkd-gateway-interface branch from df6ad01 to cea3c3c Compare August 5, 2022 20:51
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 5, 2022
…ith networking.useNetworkd

This commit drops the assertions preventing the use of `networking.defaultGateway.interface` with `networking.useNetworkd`.

It changes the `genericNetwork` function in `network-interfaces-systemd.nix` to only consider a default gateway "globally" if its `interface` option is `null`.

It adds an `interfaceGateways` function, which returns the addresses specified in `network.defaultGateway{,6}.address` if their `interface` option is specified and matches the name of the given interface. Each interface now has these gateways added to its definition.
@duairc duairc force-pushed the systemd-networkd-gateway-interface branch from cea3c3c to ac3cc6d Compare August 5, 2022 21:08
@Majiir
Copy link
Contributor

Majiir commented Oct 7, 2023

I'm sorry to see that this went unreviewed for 3+ years! 😱 Before I saw this, I wrote #258695 which gets at the same idea.

@Ma27
Copy link
Member

Ma27 commented Dec 30, 2023

Already addressed by #258695 as already mentioned, so closing this.

@Ma27 Ma27 closed this Dec 30, 2023
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