From a80b46be81716ad9270247b1afa0c16126300e12 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 17 Dec 2011 17:08:24 -0800 Subject: [PATCH] Allow a port number to be appended to a helper name Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Chains.pm | 8 ++++++-- Shorewall/Perl/Shorewall/Raw.pm | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 9a631d26b..a8c24a067 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -4002,9 +4002,13 @@ sub do_helper( $ ) { return '' if $helper eq '-'; - warning_message "Unrecognized helper ($helper)" unless $helpers{$helper}; + my $helper_base = $helper; - qq(-m helper --helper "$helper" ); + $helper_base =~ s/-\d+$//; + + warning_message "Unrecognized helper ($helper)" unless $helpers{$helper_base}; + + qq(-m helper --helper "$helper" ) if defined wantarray; } # diff --git a/Shorewall/Perl/Shorewall/Raw.pm b/Shorewall/Perl/Shorewall/Raw.pm index a96381bdd..ba843b851 100644 --- a/Shorewall/Perl/Shorewall/Raw.pm +++ b/Shorewall/Perl/Shorewall/Raw.pm @@ -76,7 +76,7 @@ sub process_notrack_rule( $$$$$$$ ) { if ( $option eq 'helper' ) { fatal_error "Invalid helper' ($args)" if $args =~ /,/; - warning_message "Unrecognized helper ($args)" unless $helpers{$args}; + do_helper( $args ); $action = "CT --helper $args"; } elsif ( $option eq 'ctevents' ) { for ( split ',', $args ) {