diff options
author | Daniil Baturin <daniil@baturin.org> | 2014-03-24 04:09:21 -0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2014-03-24 04:09:21 -0700 |
commit | b154ca0aed5604efd0a8afb6a7214d825872352d (patch) | |
tree | ce6036ba2b9908ce8de57fe13455771444550ad5 | |
parent | c9a1250e44e73a8f53666fa28f2936d2acf1d506 (diff) | |
parent | 5e481bb09c538fcf69eb9669beef2448a6cef9e5 (diff) | |
download | vyatta-nat-b154ca0aed5604efd0a8afb6a7214d825872352d.tar.gz vyatta-nat-b154ca0aed5604efd0a8afb6a7214d825872352d.zip |
Merge pull request #1 from higebu/fix-condition-of-all-deleted
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`; |