From ca391c8a4fcbdeae747fc1e0fe9858c651f47502 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 13 Apr 2020 15:20:29 +0200 Subject: [PATCH] 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. --- nixos/modules/tasks/network-interfaces.nix | 5 +++++ 1 file changed, 5 insertions(+) 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);