diff options
author | Florian Klink <flokli@flokli.de> | 2020-04-13 15:20:29 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-04-13 22:03:35 +0200 |
commit | ca391c8a4fcbdeae747fc1e0fe9858c651f47502 (patch) | |
tree | c581e64226d8464950d10fb746b78aa33c1bafdc /nixos/modules/tasks/network-interfaces.nix | |
parent | cddc7a28b825af49d6d1f8b6d34122e98d3f4c1e (diff) | |
download | nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar.gz nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar.bz2 nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar.lz nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar.xz nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.tar.zst nixpkgs-ca391c8a4fcbdeae747fc1e0fe9858c651f47502.zip |
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/network-interfaces.nix')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 63a79abd4eb..53430b0a934 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); |