Correct load_ipsets()

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-04-09 16:07:10 -07:00
parent 76c8917aa7
commit 5db6cb1b7d

View File

@ -8388,16 +8388,8 @@ sub load_ipsets() {
emit ( '' ); emit ( '' );
ensure_ipset( $_ ) for @ipsets; ensure_ipset( $_ ) for @ipsets;
emit ( '' ); emit ( '' );
emit ( ' if [ -f ${VARDIR}/ipsets.save ]; then' ,
' $IPSET flush' ,
' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}};
} }
} else { } else {
ensure_ipset( $_ ) for @ipsets;
if ( @{$globals{SAVED_IPSETS}} ) { if ( @{$globals{SAVED_IPSETS}} ) {
emit ( '' ); emit ( '' );
@ -8405,8 +8397,12 @@ sub load_ipsets() {
' $IPSET flush' , ' $IPSET flush' ,
' $IPSET destroy' , ' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' , ' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}}; " fi\n" );
} }
emit( '' );
ensure_ipset( $_ ) for @ipsets;
emit( '' );
} }
emit ( 'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' ); emit ( 'elif [ "$COMMAND" = restore -a -z "$g_recovering" ]; then' );
@ -8435,7 +8431,13 @@ sub load_ipsets() {
' $IPSET flush' , ' $IPSET flush' ,
' $IPSET destroy' , ' $IPSET destroy' ,
' $IPSET restore < ${VARDIR}/ipsets.save' , ' $IPSET restore < ${VARDIR}/ipsets.save' ,
" fi\n" ) for @{$globals{SAVED_IPSETS}}; " fi\n" );
if ( @ipsets ) {
emit ( '' );
ensure_ipset( $_ ) for @ipsets;
emit ( '' );
}
} }
if ( @ipsets ) { if ( @ipsets ) {
@ -8449,7 +8451,9 @@ sub load_ipsets() {
if ( @ipsets ) { if ( @ipsets ) {
emit( 'elif [ "$COMMAND" = refresh ]; then' ); emit( 'elif [ "$COMMAND" = refresh ]; then' );
emit ( '' );
ensure_ipset( $_ ) for @ipsets; ensure_ipset( $_ ) for @ipsets;
emit ( '' );
}; };
emit ( 'fi' , emit ( 'fi' ,