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

[WIP] systemd.network: module fixes #40573

Closed
wants to merge 5 commits into from

Conversation

flokli
Copy link
Contributor

@flokli flokli commented May 15, 2018

Motivation for this change

This PR fixes some wrong assertions currently in the systemd.network module, adds support for some not-yet-supported options, and moves some other options around to make everything them more consistent with the rest.

Contains the DHCP values fix from #35841, but nothing from the controversial "disable IPv6 usecase".

I'd love to get some feedback from people using networkd, in concert with the nixos module

/cc @andir @Mic92 @netixx

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

The previously allowed values were simply wrong. Use the one that are
used. From systemd.network(5):

> Enables DHCPv4 and/or DHCPv6 client support. Accepts "yes", "no", "ipv4", or "ipv6". Defaults to "no".
This is similar to VLAN=, MACVLAN=, VXLAN= and Tunnel=, which live in
their own attr.
his is similar to VLAN=, MACVLAN=, VXLAN= and Tunnel=, which live in
their own attr.
@@ -96,7 +96,7 @@ let
"Description" "DHCP" "DHCPServer" "IPForward" "IPMasquerade" "IPv4LL" "IPv4LLRoute"
"LLMNR" "MulticastDNS" "Domains" "Bridge" "Bond" "IPv6PrivacyExtensions"
])
(assertValueOneOf "DHCP" ["both" "none" "v4" "v6"])
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick about the commit message:
It's that those were wrong. They were simply not being documented anymore. As per systemd policy you do not (immediately) remove those old options but instead drop them from the documentation ;-)

https://github.com/systemd/systemd/blob/master/src/network/networkd-network.c#L832-L840

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, wasn't aware they are still being parsed correctly. Will update the commit message.

@@ -94,7 +94,7 @@ let
checkNetwork = checkUnitConfig "Network" [
(assertOnlyFields [
"Description" "DHCP" "DHCPServer" "IPForward" "IPMasquerade" "IPv4LL" "IPv4LLRoute"
"LLMNR" "MulticastDNS" "Domains" "Bridge" "Bond" "IPv6PrivacyExtensions"
Copy link
Member

Choose a reason for hiding this comment

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

So this breaks "old" configurations?

Shouldn't we have a change log entry for that? Or even better support (time limited) backwards compatibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it breaks old configurations that uses those attributes before.

As it's currently not the default for network management, plus the module is already pretty huge, I'd be more in favor of breaking/changing this for unstable/18.09 (with a changelog entry), than introducing a compability shim that blows up the code even more.

@@ -94,7 +94,7 @@ let
checkNetwork = checkUnitConfig "Network" [
(assertOnlyFields [
"Description" "DHCP" "DHCPServer" "IPForward" "IPMasquerade" "IPv4LL" "IPv4LLRoute"
"LLMNR" "MulticastDNS" "Domains" "Bond" "IPv6PrivacyExtensions"
Copy link
Member

Choose a reason for hiding this comment

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

So this breaks "old" configurations?

Shouldn't we have a change log entry for that? Or even better support (time limited) backwards compatibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above.

@@ -484,6 +484,16 @@ let
'';
};

vrf = mkOption {
Copy link
Member

Choose a reason for hiding this comment

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

Did you even test this?

Last time I checked after implementing this in networkd you also had to have a matching .netdev file with Kind=vrf. Currently we are not allowing Kind=vrf. See https://github.com/flokli/nixpkgs/blob/69c091096769ca2ce001beb1072ff0a25812be4e/nixos/modules/system/boot/networkd.nix#L33

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is WIP and only contains code for the .network files currently.

Adding a Kind=vrf netdev via systemd.network.netdevs.<name>.vrfConfig is currently missing, as I wanted to get some comments early in the run.

You can replicate the same via systemd.network.netdevs.<name>.extraConfig for now.

@globin
Copy link
Member

globin commented May 16, 2018

cc @fpletz

@netixx
Copy link
Contributor

netixx commented Jun 3, 2018

Thank you for importing my fixes =)

@flokli
Copy link
Contributor Author

flokli commented Jun 4, 2018

@globin, @fpletz already got a chance to take a look at this?

@flokli flokli mentioned this pull request Aug 12, 2018
9 tasks
@flokli
Copy link
Contributor Author

flokli commented Aug 16, 2018

Superseded by #44233 (merged)

@flokli flokli closed this Aug 16, 2018
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

5 participants