diff options
author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2014-03-19 17:52:08 +0900 |
---|---|---|
committer | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2014-03-19 17:52:08 +0900 |
commit | 5e481bb09c538fcf69eb9669beef2448a6cef9e5 (patch) | |
tree | ce6036ba2b9908ce8de57fe13455771444550ad5 | |
parent | c9a1250e44e73a8f53666fa28f2936d2acf1d506 (diff) | |
download | vyatta-nat-5e481bb09c538fcf69eb9669beef2448a6cef9e5.tar.gz vyatta-nat-5e481bb09c538fcf69eb9669beef2448a6cef9e5.zip |
Fix condition of all_deleted
-rwxr-xr-x | scripts/vyatta-update-dst-nat.pl | 13 | ||||
-rwxr-xr-x | scripts/vyatta-update-src-nat.pl | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/scripts/vyatta-update-dst-nat.pl b/scripts/vyatta-update-dst-nat.pl index 4a2fb9a..6543f17 100755 --- a/scripts/vyatta-update-dst-nat.pl +++ b/scripts/vyatta-update-dst-nat.pl @@ -41,6 +41,18 @@ sub raw_cleanup { } my $config = new Vyatta::Config; + +my $all_deleted = 1; + +$config->setLevel("nat source rule"); +my %rules_src = $config->listNodeStatus(); +my $rule_src; +for $rule_src (keys %rules_src) { + if ($rules_src{$rule_src} ne "deleted") { + $all_deleted = 0; + } +} + $config->setLevel($CONFIG_LEVEL." rule"); my %rules = $config->listNodeStatus(); my $rule; @@ -69,7 +81,6 @@ system("$IPTABLES -t nat -L -n >& /dev/null"); # we have some nat rule(s). make sure conntrack is enabled. ipt_enable_conntrack('iptables', 'NAT_CONNTRACK'); -my $all_deleted = 1; for $rule (@rule_keys) { print OUT "$rule: $rules{$rule}\n"; my $tmp = `iptables -L -nv --line -t nat`; diff --git a/scripts/vyatta-update-src-nat.pl b/scripts/vyatta-update-src-nat.pl index af77e22..b908cc1 100755 --- a/scripts/vyatta-update-src-nat.pl +++ b/scripts/vyatta-update-src-nat.pl @@ -41,6 +41,18 @@ sub raw_cleanup { } my $config = new Vyatta::Config; + +my $all_deleted = 1; + +$config->setLevel("nat destination rule"); +my %rules_dst = $config->listNodeStatus(); +my $rule_dst; +for $rule_dst (keys %rules_dst) { + if ($rules_dst{$rule_dst} ne "deleted") { + $all_deleted = 0; + } +} + $config->setLevel($CONFIG_LEVEL." rule"); my %rules = $config->listNodeStatus(); my $rule; @@ -69,7 +81,6 @@ system("$IPTABLES -t nat -L -n >& /dev/null"); # we have some nat rule(s). make sure conntrack is enabled. ipt_enable_conntrack('iptables', 'NAT_CONNTRACK'); -my $all_deleted = 1; for $rule (@rule_keys) { print OUT "$rule: $rules{$rule}\n"; my $tmp = `iptables -L -nv --line -t nat`; |