mirror of
https://gitlab.com/shorewall/code.git
synced 2025-05-19 23:51:07 +02:00
Bug fixes for iptables-save/-restore code
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1288 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
1f9a1de51f
commit
e11652b86a
@ -107,6 +107,15 @@ save_command()
|
|||||||
echo "$@" >> /var/lib/shorewall/restore-$$
|
echo "$@" >> /var/lib/shorewall/restore-$$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Append a file to /var/lib/shorewall/restore-$$
|
||||||
|
#
|
||||||
|
append_file() {
|
||||||
|
save_command "cat > $STATEDIR/$1 << EOF"
|
||||||
|
cat $STATEDIR/$1 >> /var/lib/shorewall/restore-$$
|
||||||
|
save_command EOF
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Run iptables and if an error occurs, stop the firewall and quit
|
# Run iptables and if an error occurs, stop the firewall and quit
|
||||||
#
|
#
|
||||||
@ -5332,12 +5341,18 @@ define_firewall() # $1 = Command (Start or Restart)
|
|||||||
|
|
||||||
date > $STATEDIR/restarted
|
date > $STATEDIR/restarted
|
||||||
|
|
||||||
|
save_command "date > $STATEDIR/restarted"
|
||||||
|
|
||||||
report "Shorewall ${1}ed"
|
report "Shorewall ${1}ed"
|
||||||
|
|
||||||
rm -rf $TMP_DIR
|
rm -rf $TMP_DIR
|
||||||
|
|
||||||
save_command "iptables-restore < /var/lib/shorewall/iptsave"
|
save_command "iptables-restore < /var/lib/shorewall/iptsave"
|
||||||
|
|
||||||
|
for file in chains nat proxyarp zones; do
|
||||||
|
append_file $file
|
||||||
|
done
|
||||||
|
|
||||||
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new
|
mv -f /var/lib/shorewall/restore-$$ /var/lib/shorewall/restore-new
|
||||||
|
|
||||||
chmod +x /var/lib/shorewall/restore-new
|
chmod +x /var/lib/shorewall/restore-new
|
||||||
|
@ -729,13 +729,18 @@ case "$1" in
|
|||||||
start)
|
start)
|
||||||
[ $# -ne 1 ] && usage 1
|
[ $# -ne 1 ] && usage 1
|
||||||
get_config
|
get_config
|
||||||
|
if [ -n "$FAST" ]; then
|
||||||
if [ -f /var/lib/shorewall/restore -a -f /var/lib/shorewall/iptsave ]; then
|
if [ -f /var/lib/shorewall/restore -a -f /var/lib/shorewall/iptsave ]; then
|
||||||
echo Restoring Shorewall...
|
echo Restoring Shorewall...
|
||||||
. /var/lib/shorewall/restore
|
. /var/lib/shorewall/restore
|
||||||
|
date > $STATEDIR/restarted
|
||||||
echo Shorewall restored
|
echo Shorewall restored
|
||||||
else
|
else
|
||||||
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock start
|
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock start
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock start
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
stop|restart|reset|clear|refresh|check)
|
stop|restart|reset|clear|refresh|check)
|
||||||
[ $# -ne 1 ] && usage 1
|
[ $# -ne 1 ] && usage 1
|
||||||
|
Loading…
Reference in New Issue
Block a user