nixos/nat: optional networking.nat.externalInterface (#41864)

to prevent "cannot coerce null to string" raise before the assertions are checked

volth d79a5057 91cda44c

Changed files
+2 -2
nixos
modules
services
networking
+2 -2
nixos/modules/services/networking/nat.nix
···
# NAT from external ports to internal ports.
${concatMapStrings (fwd: ''
iptables -w -t nat -A nixos-nat-pre \
-
-i ${cfg.externalInterface} -p ${fwd.proto} \
+
-i ${toString cfg.externalInterface} -p ${fwd.proto} \
--dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination}
···
${optionalString (cfg.dmzHost != null) ''
iptables -w -t nat -A nixos-nat-pre \
-
-i ${cfg.externalInterface} -j DNAT \
+
-i ${toString cfg.externalInterface} -j DNAT \
--to-destination ${cfg.dmzHost}
''}