summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-07-19 10:14:44 +0100
committerAlex Harpin <development@landsofshadow.co.uk>2015-07-19 10:14:44 +0100
commit5d5445e1b1851e7e0a150ad53e7286f98b20b039 (patch)
tree31af86f0eb3fea308af5c193a62707e92777b732
parent9a74a37c8cce4d7fc29ef41f628ea83b047a00f6 (diff)
downloadvyatta-nat-5d5445e1b1851e7e0a150ad53e7286f98b20b039.tar.gz
vyatta-nat-5d5445e1b1851e7e0a150ad53e7286f98b20b039.zip
Revert "vyatta-nat: check nat rules for errors before processing them for real"
This reverts commit 5f05bdd480f0de2be2d87934b9b53dab09ead9ea.
-rwxr-xr-xscripts/vyatta-update-dst-nat.pl23
-rwxr-xr-xscripts/vyatta-update-src-nat.pl23
2 files changed, 12 insertions, 34 deletions
diff --git a/scripts/vyatta-update-dst-nat.pl b/scripts/vyatta-update-dst-nat.pl
index 7cf49a2..6543f17 100755
--- a/scripts/vyatta-update-dst-nat.pl
+++ b/scripts/vyatta-update-dst-nat.pl
@@ -82,23 +82,6 @@ system("$IPTABLES -t nat -L -n >& /dev/null");
ipt_enable_conntrack('iptables', 'NAT_CONNTRACK');
for $rule (@rule_keys) {
- my $rule_test = new Vyatta::DstNatRule;
- $rule_test->setup($CONFIG_LEVEL." rule $rule");
-
- if (($rules{$rule} eq "static") || ($rules{$rule} eq "deleted")) {
- next;
- } else {
- my ($err, @rule_strs) = $rule_test->rule_str();
- if (defined $err) {
- # rule check failed => return error
- print OUT "Destination NAT configuration error in rule $rule: $err\n";
- print STDERR "Destination NAT configuration error in rule $rule: $err\n";
- exit 5;
- }
- }
-}
-
-for $rule (@rule_keys) {
print OUT "$rule: $rules{$rule}\n";
my $tmp = `iptables -L -nv --line -t nat`;
print OUT "iptables before:\n$tmp\n";
@@ -129,6 +112,12 @@ for $rule (@rule_keys) {
}
my ($err, @rule_strs) = $nrule->rule_str();
+ if (defined $err) {
+ # rule check failed => return error
+ print OUT "Destination NAT configuration error in rule $rule: $err\n";
+ print STDERR "Destination NAT configuration error in rule $rule: $err\n";
+ exit 5;
+ }
if ($rules{$rule} eq "added") {
foreach my $rule_str (@rule_strs) {
diff --git a/scripts/vyatta-update-src-nat.pl b/scripts/vyatta-update-src-nat.pl
index 20f9887..b908cc1 100755
--- a/scripts/vyatta-update-src-nat.pl
+++ b/scripts/vyatta-update-src-nat.pl
@@ -82,23 +82,6 @@ system("$IPTABLES -t nat -L -n >& /dev/null");
ipt_enable_conntrack('iptables', 'NAT_CONNTRACK');
for $rule (@rule_keys) {
- my $rule_test = new Vyatta::DstNatRule;
- $rule_test->setup($CONFIG_LEVEL." rule $rule");
-
- if (($rules{$rule} eq "static") || ($rules{$rule} eq "deleted")) {
- next;
- } else {
- my ($err, @rule_strs) = $rule_test->rule_str();
- if (defined $err) {
- # rule check failed => return error
- print OUT "Destination NAT configuration error in rule $rule: $err\n";
- print STDERR "Destination NAT configuration error in rule $rule: $err\n";
- exit 5;
- }
- }
-}
-
-for $rule (@rule_keys) {
print OUT "$rule: $rules{$rule}\n";
my $tmp = `iptables -L -nv --line -t nat`;
print OUT "iptables before:\n$tmp\n";
@@ -129,6 +112,12 @@ for $rule (@rule_keys) {
}
my ($err, @rule_strs) = $nrule->rule_str();
+ if (defined $err) {
+ # rule check failed => return error
+ print OUT "Source NAT configuration error in rule $rule: $err\n";
+ print STDERR "Source NAT configuration error in rule $rule: $err\n";
+ exit 5;
+ }
if ($rules{$rule} eq "added") {
foreach my $rule_str (@rule_strs) {