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',
|
||||
' */*)',
|
||||
' [ -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)"',
|
||||
' [ -n "$IPSET" ] || fatal_error "The ipset utility cannot be located"' ,
|
||||
' [ -n "$IPSET" ] || startup_error "The ipset utility cannot be located"' ,
|
||||
' ;;',
|
||||
'esac',
|
||||
'',
|
||||
@ -375,11 +375,15 @@ sub generate_script_3($) {
|
||||
' $IPSET -X' ,
|
||||
' $IPSET -R < ${VARDIR}/ipsets.save' ,
|
||||
' fi' ,
|
||||
'elif [ "$COMMAND" = restart ]; then' ,
|
||||
' if [ -f $(my_pathname)-ipsets ] && ! chain_exists shorewall; then' ,
|
||||
' $IPSET -F' ,
|
||||
' $IPSET -X' ,
|
||||
' $IPSET -R < $(my_pathname)-ipsets' ,
|
||||
'elif [ "$COMMAND" = restore ]; 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 -X' ,
|
||||
' $IPSET -R < $(my_pathname)-ipsets' ,
|
||||
' fi' ,
|
||||
' fi' ,
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user