From 29f6f6e3f2db768b76ae85b9b6a77865a8b55e5f Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 30 Oct 2011 06:05:24 -0700 Subject: [PATCH] Allow 'refresh' to reload chains from the BLACKLIST section. Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Chains.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index b48232646..a7a75ae34 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -1162,6 +1162,8 @@ sub add_reference ( $$ ) { assert($toref); + $toref->{blacklistsection} ||= $fromref->{blacklistsection}; + $toref->{references}{$fromref->{name}}++; } @@ -6020,6 +6022,13 @@ sub create_chainlist_reload($) { unless ( @chains ) { @chains = qw( blacklst ) if $filter_table->{blacklst}; push @chains, 'blackout' if $filter_table->{blackout}; + + unless ( @chains ) { + for ( grep $_->{blacklistsection} && $_->{referenced}, values %{$filter_table} ) { + push @chains, $_->{name} if $_->{blacklistsection}; + } + } + push @chains, 'mangle:' if have_capability( 'MANGLE_ENABLED' ) && $config{MANGLE_ENABLED}; $chains = join( ',', @chains ) if @chains; }