diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-11-08 20:35:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-08 20:35:08 +0000 |
commit | 8d145da64ad20758e5592cbe6a9702bf92eb83e9 (patch) | |
tree | 8f28e5c8d467db30a4105b89daefc6b81e5290b9 /nixos/modules | |
parent | 4d2c2d8d9f90ce174a29a82041d7d050a3a199ad (diff) | |
parent | 6091e2aa3355ac0cab30ef024b9d977111d479d8 (diff) | |
download | nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar.gz nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar.bz2 nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar.lz nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar.xz nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.tar.zst nixlib-8d145da64ad20758e5592cbe6a9702bf92eb83e9.zip |
Merge pull request #30127 from florianjacob/limit_interface_name_length
nixos/network-interfaces: assertion for too long interface names
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 8ce7b2d2cf36..1741d2c7e1f7 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -924,6 +924,14 @@ in (flip map interfaces (i: { assertion = i.subnetMask == null; message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead."; + })) ++ (flip map interfaces (i: { + # With the linux kernel, interface name length is limited by IFNAMSIZ + # to 16 bytes, including the trailing null byte. + # See include/linux/if.h in the kernel sources + assertion = stringLength i.name < 16; + message = '' + The name of networking.interfaces."${i.name}" is too long, it needs to be less than 16 characters. + ''; })) ++ (flip map slaveIfs (i: { assertion = i.ip4 == [ ] && i.ipAddress == null && i.ip6 == [ ] && i.ipv6Address == null; message = "The networking.interfaces.${i.name} must not have any defined ips when it is a slave."; |