Fix stale lock problems

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7002 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-07-30 14:35:03 +00:00
parent a419469814
commit d10cb1ba99
3 changed files with 20 additions and 19 deletions

View File

@ -25,6 +25,8 @@ Changes in 4.0.1
12) Check for state match 12) Check for state match
13) Fix stale lock problems.
Changes in 4.0.0 Final Changes in 4.0.0 Final
1) Fix lite install.sh manpage problem. 1) Fix lite install.sh manpage problem.

View File

@ -81,6 +81,11 @@ Problems corrected in 4.0.1.
10) Shorewall-perl was incorrectly rejecting 'min' as a valid unit of 10) Shorewall-perl was incorrectly rejecting 'min' as a valid unit of
time in rate-limiting specifications. time in rate-limiting specifications.
11) Certain errors occurring during
start/restart/safe-start/safe-restart/try processing could cause
the lockfile to be left behind. This resulted in a 60-second delay
the next time one of these commands was run.
Other changes in Shorewall 4.0.1. Other changes in Shorewall 4.0.1.
1) A new EXPAND_POLICIES option is added to shorewall.conf. The 1) A new EXPAND_POLICIES option is added to shorewall.conf. The

View File

@ -375,19 +375,18 @@ start_command() {
do_it() { do_it() {
local rc=0 local rc=0
[ -n "$nolock" ] || mutex_on
progress_message3 "Compiling..." progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.start; then if compiler run $debugging $nolock compile ${VARDIR}/.start; then
[ -n "$nolock" ] || mutex_on
${VARDIR}/.start $debugging start ${VARDIR}/.start $debugging start
rc=$? rc=$?
[ -n "$nolock" ] || mutex_off
else else
rc=$? rc=$?
logger -p kern.err "ERROR:Shorewall start failed" logger -p kern.err "ERROR:Shorewall start failed"
fi fi
[ -n "$nolock" ] || mutex_off
exit $rc exit $rc
} }
@ -727,19 +726,18 @@ restart_command() {
export NOROUTES export NOROUTES
[ -n "$nolock" ] || mutex_on
progress_message3 "Compiling..." progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.restart; then if compiler run $debugging $nolock compile ${VARDIR}/.restart; then
[ -n "$nolock" ] || mutex_on
$SHOREWALL_SHELL ${VARDIR}/.restart $debugging restart $SHOREWALL_SHELL ${VARDIR}/.restart $debugging restart
rc=$? rc=$?
[ -n "$nolock" ] || mutex_off
else else
rc=$? rc=$?
logger -p kern.err "ERROR:Shorewall restart failed" logger -p kern.err "ERROR:Shorewall restart failed"
fi fi
[ -n "$nolock" ] || mutex_off
return $rc return $rc
} }
@ -795,17 +793,16 @@ refresh_command() {
export NOROUTES export NOROUTES
[ -n "$nolock" ] || mutex_on
progress_message3 "Compiling..." progress_message3 "Compiling..."
if compiler run $debugging $nolock compile ${VARDIR}/.refresh; then if compiler run $debugging $nolock compile ${VARDIR}/.refresh; then
[ -n "$nolock" ] || mutex_on
$SHOREWALL_SHELL ${VARDIR}/.refresh $debugging refresh $SHOREWALL_SHELL ${VARDIR}/.refresh $debugging refresh
fi
rc=$? rc=$?
[ -n "$nolock" ] || mutex_off [ -n "$nolock" ] || mutex_off
else
rc=$?
fi
return $rc return $rc
} }
@ -882,8 +879,6 @@ safe_commands() {
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled" [ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$nolock" ] || mutex_on
if shorewall_is_started; then if shorewall_is_started; then
running=Yes running=Yes
else else
@ -893,7 +888,6 @@ safe_commands() {
if [ "$COMMAND" = "safe-start" -a -n "$running" ]; then if [ "$COMMAND" = "safe-start" -a -n "$running" ]; then
# the command is safe-start but the firewall is already running # the command is safe-start but the firewall is already running
error_message "Shorewall is already started" error_message "Shorewall is already started"
[ -n "$nolock" ] || mutex_off
exit 0 exit 0
fi fi
@ -909,7 +903,6 @@ safe_commands() {
if ! compiler run $debugging nolock compile ${VARDIR}/.$command; then if ! compiler run $debugging nolock compile ${VARDIR}/.$command; then
status=$? status=$?
[ -n "$nolock" ] || mutex_off
exit $status exit $status
fi fi
@ -926,6 +919,8 @@ safe_commands() {
;; ;;
esac esac
[ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $command; then if ${VARDIR}/.$command $command; then
echo -n "Do you want to accept the new firewall configuration? [y/n] " echo -n "Do you want to accept the new firewall configuration? [y/n] "
@ -1030,8 +1025,6 @@ try_command() {
[ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled" [ -n "$STARTUP_ENABLED" ] || fatal_error "Startup is disabled"
[ -n "$nolock" ] || mutex_on
if shorewall_is_started; then if shorewall_is_started; then
running=Yes running=Yes
else else
@ -1050,7 +1043,6 @@ try_command() {
if ! compiler run $debugging $nolock compile ${VARDIR}/.$command; then if ! compiler run $debugging $nolock compile ${VARDIR}/.$command; then
status=$? status=$?
[ -n "$nolock" ] || mutex_off
exit $status exit $status
fi fi
@ -1067,6 +1059,8 @@ try_command() {
;; ;;
esac esac
[ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $command && [ -n "$timeout" ]; then if ${VARDIR}/.$command $command && [ -n "$timeout" ]; then
sleep $timeout sleep $timeout