aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-04-13 15:20:29 +0200
committerFlorian Klink <flokli@flokli.de>2020-04-13 22:03:35 +0200
commitca391c8a4fcbdeae747fc1e0fe9858c651f47502 (patch)
treec581e64226d8464950d10fb746b78aa33c1bafdc /nixos/modules/tasks
parentcddc7a28b825af49d6d1f8b6d34122e98d3f4c1e (diff)
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.
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/network-interfaces.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 63a79abd4eb3..53430b0a9349 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -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);