mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-19 21:01:20 +01:00
Improve generated code
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
ec28bdb5a0
commit
39e74911d8
@ -4550,12 +4550,14 @@ sub load_ipsets() {
|
|||||||
' $IPSET -X' ,
|
' $IPSET -X' ,
|
||||||
' $IPSET -R < ${VARDIR}/ipsets.save' ,
|
' $IPSET -R < ${VARDIR}/ipsets.save' ,
|
||||||
' fi' );
|
' fi' );
|
||||||
}
|
|
||||||
|
|
||||||
if ( @ipsets ) {
|
if ( @ipsets ) {
|
||||||
emit ( '' );
|
emit ( '' );
|
||||||
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
|
emit ( '' );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
ensure_ipset( $_ ) for @ipsets;
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
emit ( '' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit ( 'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' );
|
emit ( 'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' );
|
||||||
@ -4571,21 +4573,30 @@ sub load_ipsets() {
|
|||||||
' fi' ,
|
' fi' ,
|
||||||
' fi' ,
|
' fi' ,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( @ipsets ) {
|
||||||
|
emit ( '' );
|
||||||
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
|
emit ( '' );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( @ipsets ) {
|
||||||
|
emit ( 'elif [ "$COMMAND" = restart ]; then' );
|
||||||
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit( 'elif [ "$COMMAND" = stop ]; then' );
|
||||||
|
|
||||||
if ( @ipsets ) {
|
if ( @ipsets ) {
|
||||||
emit '';
|
|
||||||
|
|
||||||
ensure_ipset( $_ ) for @ipsets;
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
|
emit( '' );
|
||||||
emit ( '' ,
|
}
|
||||||
'elif [ "$COMMAND" = restart ]; then' ,
|
|
||||||
'' );
|
if ( $family == F_IPV4 ) {
|
||||||
|
emit ( ' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
|
||||||
ensure_ipset( $_ ) for @ipsets;
|
|
||||||
|
|
||||||
emit ( '' ,
|
|
||||||
' if [ -f /etc/debian_version ] && [ $(cat /etc/debian_version) = 5.0.3 ]; then' ,
|
|
||||||
' #',
|
' #',
|
||||||
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
|
' # The \'grep -v\' is a hack for a bug in ipset\'s nethash implementation when xtables-addons is applied to Lenny' ,
|
||||||
' #',
|
' #',
|
||||||
@ -4596,9 +4607,15 @@ sub load_ipsets() {
|
|||||||
'',
|
'',
|
||||||
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
|
' if eval $IPSET -S $hack > ${VARDIR}/ipsets.tmp; then' ,
|
||||||
' grep -qE -- "^(-N|create )" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
|
' grep -qE -- "^(-N|create )" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
|
||||||
' fi',
|
' fi' );
|
||||||
'elif [ "$COMMAND" = refresh ]; then' );
|
} else {
|
||||||
|
emit ( ' if eval $IPSET -S > ${VARDIR}/ipsets.tmp; then' ,
|
||||||
|
' grep -qE -- "^(-N|create )" ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${VARDIR}/ipsets.save' ,
|
||||||
|
' fi' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( @ipsets ) {
|
||||||
|
emit( 'elif [ "$COMMAND" = refresh ]; then' );
|
||||||
ensure_ipset( $_ ) for @ipsets;
|
ensure_ipset( $_ ) for @ipsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user