mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 22:58:52 +01:00
Improve IPSET_SAVE restore logic:
- Call startup_error() rather than fatal_error() - Call startup_error when restore-ipsets file exists but Shorewall is running Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
84051ca19a
commit
d6123a8fbc
@ -361,11 +361,11 @@ sub generate_script_3($) {
|
|||||||
'',
|
'',
|
||||||
'case $IPSET in',
|
'case $IPSET in',
|
||||||
' */*)',
|
' */*)',
|
||||||
' [ -x "$IPSET" ] || fatal_error "IPSET=$IPSET does not exist or is not executable"',
|
' [ -x "$IPSET" ] || startup_error "IPSET=$IPSET does not exist or is not executable"',
|
||||||
' ;;',
|
' ;;',
|
||||||
' *)',
|
' *)',
|
||||||
' IPSET="$(mywhich $IPSET)"',
|
' IPSET="$(mywhich $IPSET)"',
|
||||||
' [ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"' ,
|
' [ -n "$IPSET" ] || startup_error "The ipset utility cannot be located"' ,
|
||||||
' ;;',
|
' ;;',
|
||||||
'esac',
|
'esac',
|
||||||
'',
|
'',
|
||||||
@ -375,12 +375,16 @@ sub generate_script_3($) {
|
|||||||
' $IPSET -X' ,
|
' $IPSET -X' ,
|
||||||
' $IPSET -R < ${VARDIR}/ipsets.save' ,
|
' $IPSET -R < ${VARDIR}/ipsets.save' ,
|
||||||
' fi' ,
|
' fi' ,
|
||||||
'elif [ "$COMMAND" = restart ]; then' ,
|
'elif [ "$COMMAND" = restore ]; then' ,
|
||||||
' if [ -f $(my_pathname)-ipsets ] && ! chain_exists shorewall; then' ,
|
' if [ -f $(my_pathname)-ipsets ]; then' ,
|
||||||
|
' if chain_exists shorewall; then' ,
|
||||||
|
' startup_error "Cannot restore $(my_pathname)-ipsets with Shorewall running"' ,
|
||||||
|
' else' ,
|
||||||
' $IPSET -F' ,
|
' $IPSET -F' ,
|
||||||
' $IPSET -X' ,
|
' $IPSET -X' ,
|
||||||
' $IPSET -R < $(my_pathname)-ipsets' ,
|
' $IPSET -R < $(my_pathname)-ipsets' ,
|
||||||
' fi' ,
|
' fi' ,
|
||||||
|
' fi' ,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( @ipsets ) {
|
if ( @ipsets ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user