summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-05-12 11:02:43 +0100
committerDomen Kožar <domen@dev.si>2016-05-12 11:04:06 +0100
commit25e3c091a07374f49ff74d0a69a4515715bff43b (patch)
tree54fb04140081790835025ab40574b3e22444c603
parentthunderbird: set requiredSystemFeatures to big-parallel (diff)
downloadnixpkgs-black@2016-05-13.tar.gz
Revert "nixos/nat: Allow nat without an externalInterface"black@2016-05-13
This reverts commit 431a98b12b5e1cc51181da815870dda5e23709f8. Breaks nixos tests: http://hydra.nixos.org/build/35538207
-rw-r--r--nixos/modules/services/networking/nat.nix13
1 files changed, 4 insertions, 9 deletions
diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix
index f35b0f68e3ef..9d163e60d5ea 100644
--- a/nixos/modules/services/networking/nat.nix
+++ b/nixos/modules/services/networking/nat.nix
@@ -12,9 +12,6 @@ let
dest = if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}";
- externalInterfaceFilter = param:
- optionalString (cfg.externalInterface != null) "${param} ${cfg.externalInterface}";
-
flushNat = ''
iptables -w -t nat -D PREROUTING -j nixos-nat-pre 2>/dev/null|| true
iptables -w -t nat -F nixos-nat-pre 2>/dev/null || true
@@ -39,20 +36,19 @@ let
# NAT the marked packets.
${optionalString (cfg.internalInterfaces != []) ''
iptables -w -t nat -A nixos-nat-post -m mark --mark 1 \
- ${externalInterfaceFilter "-o"} ${dest}
+ -o ${cfg.externalInterface} ${dest}
''}
# NAT packets coming from the internal IPs.
${concatMapStrings (range: ''
iptables -w -t nat -A nixos-nat-post \
- -s '${range}' \! -d '${range}'
- ${externalInterfaceFilter "-o"} ${dest}
+ -s '${range}' -o ${cfg.externalInterface} ${dest}
'') cfg.internalIPs}
# NAT from external ports to internal ports.
${concatMapStrings (fwd: ''
iptables -w -t nat -A nixos-nat-pre \
- ${externalInterfaceFilter "-i"} -p tcp \
+ -i ${cfg.externalInterface} -p tcp \
--dport ${builtins.toString fwd.sourcePort} \
-j DNAT --to-destination ${fwd.destination}
'') cfg.forwardPorts}
@@ -104,8 +100,7 @@ in
};
networking.nat.externalInterface = mkOption {
- type = types.nullOr types.str;
- default = null;
+ type = types.str;
example = "eth1";
description =
''