On 01/11/2013 01:03 PM, Steven Jan Springl wrote:

> In the attached config. host file entry:
> 
> lan  eth0:!0.0.0.0/0  -
> 
> generates the following iptables rule:
> 
> -A PREROUTING -i eth0 -j ~excl0
> 
> which produces the following error message:
> 
> iptables-restore v1.4.17: Couldn't load target `~excl0':No such file or 
> directory

The attached patch seems to eliminate the problem. I'm rather surprised
that you haven't run into this one before; there were similar cases is
three of your large configurations that I have in my regression suite.

Thanks Steven,
-Tom
-- 
Tom Eastep        \ When I die, I want to go like my Grandfather who
Shoreline,         \ died peacefully in his sleep. Not screaming like
Washington, USA     \ all of the passengers in his car
http://shorewall.net \________________________________________________
diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm
index f16b53f..33930d7 100644
--- a/Shorewall/Perl/Shorewall/Chains.pm
+++ b/Shorewall/Perl/Shorewall/Chains.pm
@@ -1419,9 +1419,21 @@ sub delete_chain_and_references( $ ) {
     #  We're going to delete this chain but first, we must delete all references to it.
     #
     my $tableref = $chain_table{$chainref->{table}};
-    my $name1    = $chainref->{name};
-    for ( @{$chainref->{rules}} ) {
-	decrement_reference_count( $tableref->{$_->{target}}, $name1 ) if $_->{target};
+    my $name     = $chainref->{name};
+   
+    while ( my ( $chain, $references ) = each %{$chainref->{references}} ) {
+	my $chain1ref = $tableref->{$chain};
+	my @newrules;
+
+	for ( @{$chain1ref->{rules}} ) {
+	    if ( ( $_->{target} || '' ) eq $name ) {
+		last if --$references <= 0;
+	    } else {
+		push @newrules, $_;
+	    }
+	}
+	
+	$chain1ref->{rules} = \@newrules;
     }
 
     delete_chain $chainref;

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Shorewall-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-devel

Reply via email to