nixos/networking: add assertion catching setting mac addresses on tun devices

Setting a MAC Address on a tun interface isn't supported, and invoking
the corresponding command fails.
This commit is contained in:
Florian Klink 2020-04-13 15:20:29 +02:00
parent cddc7a28b8
commit ca391c8a4f

View file

@ -1031,6 +1031,11 @@ in
message = ''
Temporary addresses are only needed when IPv6 is enabled.
'';
})) ++ (forEach interfaces (i: {
assertion = (i.virtual && i.virtualType == "tun") -> i.macAddress == null;
message = ''
Setting a MAC Address for tun device ${i.name} isn't supported.
'';
})) ++ [
{
assertion = cfg.hostId == null || (stringLength cfg.hostId == 8 && isHexString cfg.hostId);