mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 14:48:51 +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,11 +375,15 @@ 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' ,
|
||||||
' $IPSET -F' ,
|
' if chain_exists shorewall; then' ,
|
||||||
' $IPSET -X' ,
|
' startup_error "Cannot restore $(my_pathname)-ipsets with Shorewall running"' ,
|
||||||
' $IPSET -R < $(my_pathname)-ipsets' ,
|
' else' ,
|
||||||
|
' $IPSET -F' ,
|
||||||
|
' $IPSET -X' ,
|
||||||
|
' $IPSET -R < $(my_pathname)-ipsets' ,
|
||||||
|
' fi' ,
|
||||||
' fi' ,
|
' fi' ,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user