From 63d7580219aab53c6c6e79997c853bce8d0f56c7 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sat, 7 Jan 2017 10:01:03 -0800 Subject: [PATCH] Allow compact IPv6 addresses in IP6TABLES() rules Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 025724ceb..b70db0715 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -2000,6 +2000,21 @@ sub find_writable_file($) { "$config_path[0]$filename"; } +# +# Determine if a value has been supplied +# +sub supplied( $ ) { + my $val = shift; + + defined $val && $val ne ''; +} + +sub passed( $ ) { + my $val = shift; + + defined $val && $val ne '' && $val ne '-'; +} + # # Split a comma-separated list into a Perl array # @@ -2058,7 +2073,7 @@ sub split_list1( $$;$ ) { sub split_list2( $$ ) { my ($list, $type ) = @_; - fatal_error "Invalid $type ($list)" if $list =~ /^:|::/; + fatal_error "Invalid $type ($list)" if $list =~ /^:/; my @list1 = split /:/, $list; my @list2; @@ -2095,6 +2110,7 @@ sub split_list2( $$ ) { fatal_error "Invalid $type ($list)" if $opencount < 0; } } elsif ( $element eq '' ) { + fatal_error "Invalid $type ($list)" unless supplied $_; push @list2 , $_; } else { $element = join ':', $element , $_; @@ -2260,21 +2276,6 @@ sub split_columns( $ ) { @list2; } -# -# Determine if a value has been supplied -# -sub supplied( $ ) { - my $val = shift; - - defined $val && $val ne ''; -} - -sub passed( $ ) { - my $val = shift; - - defined $val && $val ne '' && $val ne '-'; -} - sub clear_comment(); #