Open grische opened 4 years ago
Yeah, we should probably be stricter with the device names. Those are fixed to IFNAMSIZ (16) and require a zero byte at the end. So linux permits at most 15 characters for device names and that is likely why systemd is refusing this.
After a quick look a this we should add a maxStringLength
function to nixos/modules/system/boot/systemd-lib.nix
like so:
{ # …
maxStringLength = num: s: stringLength s <= num;
# …
assertMaxStringLength = name: max: group: attr: optional (attr ? ${name} && ! maxStringLength max attr.${name})
"Error on systemd ${group} field `${name}` maximum permitted string length of ${toString max} exceeded with value `${attr.${name}}.";
and then add it in nixos/modules/system/boot/systemd-lib.nix
for Link
, Netdev
and probably Network
each on the Name
field.
https://github.com/systemd/systemd/blob/master/NEWS#L1496-L1506 might be related. udev now supports longer AlternativeNames
I marked this as stale due to inactivity. → More info
Still relevant
Describe the bug When creating an interface with a name with exactly 16 characters, the configuration is accepted but the generated systemd netdev unit fails.
To Reproduce Steps to reproduce the behavior:
Expected behavior Throw an error during validation/building
Screenshots
The config
Additional context
NixOS channel 20.03