git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #30127 from florianjacob/limit_interface_name_length

nixos/network-interfaces: assertion for too long interface names

commit8d145da64ad20758e5592cbe6a9702bf92eb83e9 authorJörg Thalheim <Mic92@users.noreply.github.com> dateWed 8 Nov 2017, 20:35 (9 years ago) parent4d2c2d86091e2a
1 file changed+8
nixos/modules/tasks/network-interfaces.nix+8
nixos/modules/tasks/network-interfaces.nix+8
@@ -924,6 +924,14 @@ in
924924 (flip map interfaces (i: {
925925 assertion = i.subnetMask == null;
926926 message = "The networking.interfaces.${i.name}.subnetMask option is defunct. Use prefixLength instead.";
927+ })) ++ (flip map interfaces (i: {
928+ # With the linux kernel, interface name length is limited by IFNAMSIZ
929+ # to 16 bytes, including the trailing null byte.
930+ # See include/linux/if.h in the kernel sources
931+ assertion = stringLength i.name < 16;
932+ message = ''
933+ The name of networking.interfaces."${i.name}" is too long, it needs to be less than 16 characters.
934+ '';
927935 })) ++ (flip map slaveIfs (i: {
928936 assertion = i.ip4 == [ ] && i.ipAddress == null && i.ip6 == [ ] && i.ipv6Address == null;
929937 message = "The networking.interfaces.${i.name} must not have any defined ips when it is a slave.";