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/networking: fix setting MAC Address and MTU in networkd, fix tests #85170
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 tasks
teto
approved these changes
Apr 13, 2020
rnhmjoj
reviewed
Apr 13, 2020
rnhmjoj
reviewed
Apr 13, 2020
flokli
force-pushed
the
networking-virtual
branch
2 times, most recently
from
April 13, 2020 20:03
38fca3f
to
d749e32
Compare
This needs to be set in the .linkConfig of a .network
… devices Setting a MAC Address on a tun interface isn't supported, and invoking the corresponding command fails.
The unit sets MTU and MAC Address even with networkd enabled, which isn't necessary anymore, as networkd handles this by itself.
This was whitespace-sensitive, kept fighting with my editor and broke the tests easily. To fix this, let python convert the output to individual lines, and strip whitespace from them before comparing.
We only need to wait for network.target to get up, and the network-addresses-${interfaceName} units are scripted networking only.
Both the scripted and networkd backend now support setting MTU and MAC Address, so do this in a test to ensure it doesn't break.
flokli
force-pushed
the
networking-virtual
branch
from
April 13, 2020 20:03
d749e32
to
d1edd8b
Compare
rnhmjoj
approved these changes
Apr 13, 2020
lheckemann
approved these changes
Apr 14, 2020
I run all tests again on x86_64 and aarch64. Everything is passing. |
Backported the fix in 897182c. |
10 tasks
10 tasks
flokli
added a commit
to flokli/nixpkgs
that referenced
this pull request
May 22, 2020
…MTUBytes The `network-link-${i.name}` units raced with other things trying to configure the interface, or ran before the interface was available. Instead of running our own set of shell scripts on boot, and hoping they're executed at the right time, we can make use of udev to configure the interface *while they appear*, by providing `.link` files in /etc/systemd/network/*.link to set MACAddress and MTUBytes. This doesn't require networkd to be enabled, and is populated properly on non-networkd systems since NixOS#82941. This continues clean-up work done in NixOS#85170 for the scripted networking stack. The only leftover part of the `network-link-${i.name}` unit (bringing the interface up) is moved to the beginning of the `network-addresses-${i.name}` unit. Fixes: NixOS#74471 Closes: NixOS#87116
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
This cleans up code setting MTU and MAC Address. We only use
network-link-${interfaceName}
in scripted networking, and use the native networkd methods to set it in case of networkd.This also improves the reliability of the networking tests, and fixes
nixosTests.networking.networkd.virtual
.@rnhmjoj We can just backport a501abd5499d8f82f0991a7b78bcbc4169b0537f into 20.03 to fix the test there as well.
Ran all tests in
nixosTests.networking.networkd
andnixosTests.networking.scripted
in master, and 20.03 with a501abd5499d8f82f0991a7b78bcbc4169b0537f cherry-picked, they succeed now 🎉Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)