Merge pull request #30127 from florianjacob/limit_interface_name_length

nixos/network-interfaces: assertion for too long interface names
This commit is contained in:
Jörg Thalheim 2017-11-08 20:35:08 +00:00 committed by GitHub
commit 8d145da64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.";