diff options
author | Masakazu Asama <m-asama@ginzado.co.jp> | 2014-05-30 11:20:20 +0900 |
---|---|---|
committer | Masakazu Asama <m-asama@ginzado.co.jp> | 2014-05-30 11:20:20 +0900 |
commit | e1f9087305f3658faa04fc4653516a465041da37 (patch) | |
tree | 53bb798be5384fd3e6c1911314daf00fc6bbdca1 | |
parent | 61f03ea2975b88ad56ffb71b0472f1bdaba396e5 (diff) | |
download | vyatta-nat-e1f9087305f3658faa04fc4653516a465041da37.tar.gz vyatta-nat-e1f9087305f3658faa04fc4653516a465041da37.zip |
Fix some required -j target rules delete bug when delete source/destination nat rule
-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..5b8f329 100755 --- a/scripts/vyatta-update-dst-nat.pl +++ b/scripts/vyatta-update-dst-nat.pl @@ -40,7 +40,19 @@ sub raw_cleanup { ipt_disable_conntrack('iptables', 'NAT_CONNTRACK'); } +my $all_deleted = 1; + my $config = new Vyatta::Config; + +$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..2c481e1 100755 --- a/scripts/vyatta-update-src-nat.pl +++ b/scripts/vyatta-update-src-nat.pl @@ -40,7 +40,19 @@ sub raw_cleanup { ipt_disable_conntrack('iptables', 'NAT_CONNTRACK'); } +my $all_deleted = 1; + my $config = new Vyatta::Config; + +$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`; |