Apply COUNT change to trunk

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9348 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2009-01-28 19:35:21 +00:00
parent 30e8542b8a
commit 4dbd06792c
5 changed files with 17 additions and 7 deletions

View File

@ -565,6 +565,8 @@ sub process_action( $$$$$$$$$$ ) {
( $action, my $param ) = get_target_param $action; ( $action, my $param ) = get_target_param $action;
$param = 1 unless defined $param; $param = 1 unless defined $param;
$action = "NFQUEUE --queue-num $param"; $action = "NFQUEUE --queue-num $param";
} elsif ( $action eq 'COUNT' ) {
$action = '';
} }
expand_rule ( $chainref , expand_rule ( $chainref ,
@ -574,7 +576,7 @@ sub process_action( $$$$$$$$$$ ) {
$dest , $dest ,
'', #Original Dest '', #Original Dest
'', #Original Dest port '', #Original Dest port
"-j $action" , $action ? "-j $action" : '',
$level , $level ,
$action , $action ,
'' ); '' );

View File

@ -263,6 +263,7 @@ our %builtin_target = ( ACCEPT => 1,
REJECT => 1, REJECT => 1,
DROP => 1, DROP => 1,
RETURN => 1, RETURN => 1,
COUNT => 1,
DNAT => 1, DNAT => 1,
SAME => 1, SAME => 1,
LOG => 1, LOG => 1,
@ -945,6 +946,7 @@ sub initialize_chain_table()
'LOG' => STANDARD + LOGRULE, 'LOG' => STANDARD + LOGRULE,
'CONTINUE' => STANDARD, 'CONTINUE' => STANDARD,
'CONTINUE!' => STANDARD, 'CONTINUE!' => STANDARD,
'COUNT' => STANDARD,
'QUEUE' => STANDARD, 'QUEUE' => STANDARD,
'QUEUE!' => STANDARD, 'QUEUE!' => STANDARD,
'NFQUEUE' => STANDARD + NFQ, 'NFQUEUE' => STANDARD + NFQ,
@ -996,6 +998,7 @@ sub initialize_chain_table()
'LOG' => STANDARD + LOGRULE, 'LOG' => STANDARD + LOGRULE,
'CONTINUE' => STANDARD, 'CONTINUE' => STANDARD,
'CONTINUE!' => STANDARD, 'CONTINUE!' => STANDARD,
'COUNT' => STANDARD,
'QUEUE' => STANDARD, 'QUEUE' => STANDARD,
'QUEUE!' => STANDARD, 'QUEUE!' => STANDARD,
'NFQUEUE' => STANDARD + NFQ, 'NFQUEUE' => STANDARD + NFQ,

View File

@ -1096,6 +1096,8 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$action = 'reject'; $action = 'reject';
} elsif ( $action eq 'CONTINUE' ) { } elsif ( $action eq 'CONTINUE' ) {
$action = 'RETURN'; $action = 'RETURN';
} elsif ( $action eq 'COUNT' ) {
$action = '';
} elsif ( $actiontype & LOGRULE ) { } elsif ( $actiontype & LOGRULE ) {
fatal_error 'LOG requires a log level' unless defined $loglevel and $loglevel ne ''; fatal_error 'LOG requires a log level' unless defined $loglevel and $loglevel ne '';
} }
@ -1384,7 +1386,7 @@ sub process_rule1 ( $$$$$$$$$$$$$ ) {
$dest , $dest ,
$origdest , $origdest ,
$origdstports , $origdstports ,
"-j $action " , $action ? "-j $action " : '' ,
$loglevel , $loglevel ,
$action , $action ,
'' ); '' );

View File

@ -2613,7 +2613,7 @@ process_macro() # $1 = target
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
[ $mtarget = COMMENT ] && continue [ $mtarget = COMMENT -o $mtarget = COUNT ] && continue
mtarget=$(merge_levels $itarget $mtarget) mtarget=$(merge_levels $itarget $mtarget)

View File

@ -383,6 +383,9 @@ process_action() # $1 = chain (Chain to add the rules to)
CONTINUE) CONTINUE)
target=RETURN target=RETURN
;; ;;
COUNT)
return;
;;
*) *)
;; ;;
esac esac
@ -615,7 +618,7 @@ process_actions1() {
while read xtarget xclients xservers xprotocol xports xcports xratelimit $xuserspec $xmark; do while read xtarget xclients xservers xprotocol xports xcports xratelimit $xuserspec $xmark; do
temp="${xtarget%%:*}" temp="${xtarget%%:*}"
case "$temp" in case "$temp" in
ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE) ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE|COUNT)
;; ;;
COMMENT) COMMENT)
if [ "$temp" != "$xtarget" ]; then if [ "$temp" != "$xtarget" ]; then
@ -659,7 +662,7 @@ process_actions1() {
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
[ $mtarget = COMMENT ] && continue [ $mtarget = COMMENT -o $mtarget = COUNT ] && continue
temp="${mtarget%%:*}" temp="${mtarget%%:*}"
case "$temp" in case "$temp" in
@ -771,7 +774,7 @@ process_action3() {
xtarget1=${xaction2%%:*} xtarget1=${xaction2%%:*}
case $xtarget1 in case $xtarget1 in
ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE) ACCEPT|DROP|REJECT|LOG|QUEUE|CONTINUE|COUNT)
# #
# Builtin target -- Nothing to do # Builtin target -- Nothing to do
# #
@ -816,7 +819,7 @@ process_action3() {
while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do while read mtarget mclients mservers mprotocol mports mcports mratelimit muserspec; do
[ $mtarget = COMMENT ] && continue [ $mtarget = COMMENT -o $mtarget = COUNT ] && continue
mtarget=$(merge_levels $xaction2 $mtarget) mtarget=$(merge_levels $xaction2 $mtarget)