mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
nixos/network-interfaces: assertion for DHCP on bridges
Assert that the user doesn't have a bridge configured while networking.useDHCP is true. Due to new behaviour of dhcpcd [0], this would result in the bridge not getting an address via DHCP, regardless of wether it has networking.interfaces.<name?>.useDHCP set or not. [0] https://roy.marples.name/archives/dhcpcd-discuss/0002621.html
This commit is contained in:
@@ -976,6 +976,17 @@ in
|
||||
Temporary addresses are only needed when IPv6 is enabled.
|
||||
'';
|
||||
})) ++ [
|
||||
{
|
||||
assertion = cfg.useDHCP -> cfg.bridges == {};
|
||||
message = ''
|
||||
There are the bridges [ ${builtins.toString (builtins.attrNames cfg.bridges)} ] configured while `networking.useDHCP` is enabled.
|
||||
dhcpcd doesn't give IPv4 addresses to bridges by default anymore,
|
||||
so you have to set `networking.useDHCP = false` and then whitelist
|
||||
every interface you need DHCP on with
|
||||
`networking.interfaces.<name?>.useDHCP = true`.
|
||||
'';
|
||||
}
|
||||
] ++ [
|
||||
{
|
||||
assertion = cfg.hostId == null || (stringLength cfg.hostId == 8 && isHexString cfg.hostId);
|
||||
message = "Invalid value given to the networking.hostId option.";
|
||||
|
||||
Reference in New Issue
Block a user