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/network-interfaces-systemd: improve default ethernet network matching #347283

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

player131007
Copy link
Contributor

@player131007 player131007 commented Oct 8, 2024

Reliably match physical ethernet interfaces by using Kind=!* with Type=ether. This will exclude veth interfaces, which have Kind=veth.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
    • NixOS test(s) (look inside nixos/tests)
      • nixosTests.networking.networkd.dhcpDefault
      • nixosTests.networking.networkd.dhcpSimple
      • nixosTests.networking.networkd.dhcpOneIf
      • nixosTests.networking.networkd.static
    • and/or package tests
    • or, for functions and "core" functionality, tests in lib/tests or pkgs/test
    • made sure NixOS tests are linked to the relevant packages
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

…tching

Reliably match physical ethernet interfaces by using `Kind=!*` with `Type=ether`.
This will exclude veth interfaces, which have `Kind=veth`.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Oct 8, 2024
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Oct 8, 2024
@JohnRTitor JohnRTitor requested review from ElvishJerricco, LeSuisse and a team November 15, 2024 20:34
@ElvishJerricco
Copy link
Contributor

ElvishJerricco commented Nov 16, 2024

Yea I've been wondering about changing it to work like this for a while now. They do this in systemd-network-generator for the ip=dhcp kernel param for exactly the reasons you described. In fact, they go so far as to use Type=!loopback, presumably because that would allow it to work for wlans. So I wonder if we should do the same and eliminate the catchall network we have for wlans a little further down in nixos/modules/tasks/network-interfaces-systemd.nix. What do you think? Is that a good idea? Or is it better to just match ether and WLANInterfaceType=station separately?

@player131007
Copy link
Contributor Author

I think we should keep them separate. A WLAN device could also be a hotspot or an ad-hoc network.

@ElvishJerricco
Copy link
Contributor

That makes plenty of sense to me. Thanks.

@ElvishJerricco ElvishJerricco merged commit 9100366 into NixOS:master Nov 19, 2024
30 checks passed
adamcstephens added a commit to adamcstephens/nixpkgs that referenced this pull request Nov 23, 2024
NixOS#347283 changed the default to
exclude non-physical network Kind, but that unfortunately also includes
`veth` which LXC uses for its network interfaces. Re-enable that
functionality so users can use networkd with useDHCP.
@adamcstephens
Copy link
Contributor

adamcstephens commented Nov 23, 2024

This broke networkd+useDHCP on LXC containers. Fix submitted here: #358519

adamcstephens added a commit to adamcstephens/nixpkgs that referenced this pull request Nov 24, 2024
NixOS#347283 changed the default to
exclude non-physical network Kind, but that unfortunately also includes
`veth` which LXC uses for its network interfaces. Re-enable that
functionality so users can use networkd with useDHCP.
adamcstephens added a commit to adamcstephens/nixpkgs that referenced this pull request Nov 29, 2024
NixOS#347283 changed the default to
exclude non-physical network Kind, but that unfortunately also includes
`veth` which LXC uses for its network interfaces. Re-enable that
functionality so users can use networkd with useDHCP.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants