Implement 'reload' command

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3243 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-01-07 06:04:16 +00:00
parent b1f25a1a4f
commit ab7c5cdff9
4 changed files with 47 additions and 10 deletions

View File

@ -7351,7 +7351,7 @@ setup_masq()
if [ -n "$NAT_ENABLED" ]; then if [ -n "$NAT_ENABLED" ]; then
echo "Masqueraded Networks and Hosts:" echo "Masqueraded Networks and Hosts:"
[ -n "$RETAIN_ALIASES" -o $COMMAND = check ] || save_progress_message "Restoring Masquerading/SNAT..." [ $COMMAND = check ] || save_progress_message "Restoring Masquerading/SNAT..."
fi fi
while read fullinterface networks addresses proto ports ipsec; do while read fullinterface networks addresses proto ports ipsec; do
@ -8868,7 +8868,7 @@ generate_firewall() # $1 = File Name
} }
run_iptables2()){ run_iptables2() {
run_iptables $(fix_bang $@) run_iptables $(fix_bang $@)
} }
@ -9018,7 +9018,7 @@ generate_firewall() # $1 = File Name
run_user_exit started run_user_exit started
case $1 in case $1 in
.*|/*) ./*|../*|/*)
file=$1 file=$1
;; ;;
*) *)

View File

@ -169,6 +169,14 @@ reject)
See also \"help address\"" See also \"help address\""
;; ;;
reload)
echo "reload: reload [ <directory name> ]
Causes Shorewall to generate a new compiled restore file using the named directory
as the first search directory for configuration file. If that generation is error-free,
the generated restore file is executed."
;;
reset) reset)
echo "reset: reset echo "reset: reset
All the packet and byte counters in the firewall are reset." All the packet and byte counters in the firewall are reset."

View File

@ -31,7 +31,7 @@ RCDLINKS="2,S41 3,S41 6,K41"
# #
# shorewall start Starts the firewall # shorewall start Starts the firewall
# shorewall restart Restarts the firewall # shorewall restart Restarts the firewall
# shorewall reload Restarts the firewall # shorewall reload Reload the firewall
# shorewall stop Stops the firewall # shorewall stop Stops the firewall
# shorewall status Displays firewall status # shorewall status Displays firewall status
# #
@ -75,13 +75,9 @@ case "$command" in
start) start)
exec /sbin/shorewall $OPTIONS $@ exec /sbin/shorewall $OPTIONS $@
;; ;;
stop|restart|status) stop|restart|status|reload)
exec /sbin/shorewall $@ exec /sbin/shorewall $@
;; ;;
reload)
shift
exec /sbin/shorewall restart $@
;;
*) *)
usage usage
;; ;;

View File

@ -109,7 +109,9 @@
# configuration # configuration
# #
# shorewall generate [ <directory> ] ]<filename> # shorewall generate [ <directory> ] ]<filename>
# Compile a pseudo restore file. # Compile a pseudo restore file.
#
# shorewall reload [ <directory name> ] Safe reload
# #
# Fatal Error # Fatal Error
# #
@ -516,6 +518,7 @@ usage() # $1 = exit status
echo " refresh" echo " refresh"
echo " reject <address> ..." echo " reject <address> ..."
echo " reset" echo " reset"
echo " reload [ <directory> ]"
echo " restart [ <directory> ]" echo " restart [ <directory> ]"
echo " restore [ <file name> ]" echo " restore [ <file name> ]"
echo " save [ <file name> ]" echo " save [ <file name> ]"
@ -873,6 +876,36 @@ case "$1" in
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $1 exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $1
;; ;;
reload)
case $# in
1)
;;
2)
[ -n "$SHOREWALL_DIR" ] && usage 2
if [ ! -d $2 ]; then
if [ -e $2 ]; then
echo "$2 is not a directory" >&2 && exit 2
else
echo "Directory $2 does not exist" >&2 && exit 2
fi
fi
SHOREWALL_DIR=$2
export SHOREWALL_DIR
;;
*)
usage 1
;;
esac
export NOROUTES
if $SHOREWALL_SHELL $FIREWALL $debugging $nolock generate .reload; then
[ -n "$QUIET" ] && QUIET=-q
$0 $QUIET restore .reload
fi
;;
show|list) show|list)
[ -n "$debugging" ] && set -x [ -n "$debugging" ] && set -x
case "$2" in case "$2" in