diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm
index bf3c963f7..5176a1d51 100644
--- a/Shorewall/Perl/Shorewall/Rules.pm
+++ b/Shorewall/Perl/Shorewall/Rules.pm
@@ -475,28 +475,36 @@ sub process_default_action( $$$$ ) {
sub handle_nfqueue( $$ ) {
my ($params, $allow_bypass ) = @_;
my $action;
+ my ( $queue1, $queue2, $queuenum1, $queuenum2 );
require_capability( 'NFQUEUE_TARGET', 'NFQUEUE Rules and Policies', '' );
- my ( $queue, $bypass ) = split ',', $params;
+ $params = '' unless defined $params;
- if ( $queue eq 'bypass' ) {
- fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
- fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass;
- return 'NFQUEUE --queue-bypass';
- }
+ my ( $queue, $bypass, $junk ) = split ',', $params;
- my ( $queue1, $queue2 ) = split ':', $queue;
+ fatal_error "Invalid NFQUEUE parameter list" if defined $junk;
- my $queuenum1 = numeric_value( $queue1 );
- my $queuenum2;
+ if ( supplied $queue ) {
+ if ( $queue eq 'bypass' ) {
+ fatal_error "'bypass' is not allowed in this context" unless $allow_bypass;
+ fatal_error "Invalid NFQUEUE options (bypass,$bypass)" if supplied $bypass;
+ return 'NFQUEUE --queue-bypass';
+ }
- fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535;
+ ( $queue1, $queue2 ) = split ':', $queue;
- if ( supplied $queue2 ) {
- $queuenum2 = numeric_value( $queue2 );
+ $queuenum1 = numeric_value( $queue1 );
- fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2;
+ fatal_error "Invalid NFQUEUE queue number ($queue1)" unless defined( $queuenum1) && $queuenum1 >= 0 && $queuenum1 <= 65535;
+
+ if ( supplied $queue2 ) {
+ $queuenum2 = numeric_value( $queue2 );
+
+ fatal_error "Invalid NFQUEUE queue number ($queue2)" unless defined( $queuenum2) && $queuenum2 >= 0 && $queuenum2 <= 65535 && $queuenum1 < $queuenum2;
+ }
+ } else {
+ $queuenum1 = 0;
}
if ( supplied $bypass ) {
diff --git a/Shorewall/manpages/shorewall-policy.xml b/Shorewall/manpages/shorewall-policy.xml
index fb53245e6..24b619d1a 100644
--- a/Shorewall/manpages/shorewall-policy.xml
+++ b/Shorewall/manpages/shorewall-policy.xml
@@ -105,7 +105,7 @@
role="bold">REJECT|CONTINUE|QUEUE|NFQUEUE[(queuenumber1[,queuenumber2])]|NFQUEUE[(queuenumber1[:queuenumber2])]|NONE}[:{default-action-or-macro[:level]|None}]
diff --git a/Shorewall6/manpages/shorewall6-policy.xml b/Shorewall6/manpages/shorewall6-policy.xml
index 1024eb424..614186375 100644
--- a/Shorewall6/manpages/shorewall6-policy.xml
+++ b/Shorewall6/manpages/shorewall6-policy.xml
@@ -105,7 +105,7 @@
role="bold">REJECT|CONTINUE|QUEUE|NFQUEUE[(queuenumber1[,queuenumber2])]|NFQUEUE[(queuenumber1[:queuenumber2])]|NONE}[:{default-action-or-macro[:level]|None}]