*** ipfw.orig 2010-07-31 18:52:54.000000000 -0400 --- ipfw 2010-12-17 10:02:54.000000000 -0500 *************** *** 39,45 **** --- 39,56 ---- _firewall_type=$1 + # check if firewall already running to prevent subsequent start calls + # + [ $( ${SYSCTL_N} net.inet.ip.fw.enable ) -ne 0 ] && { + warn 'Firewall is already running.'; + _ipfw_running_status=1; + return 1; + } || { + _ipfw_running_status=0; + } + # set the firewall rules script if none was specified + # [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall if [ -r "${firewall_script}" ]; then *************** *** 55,61 **** # if checkyesno firewall_logging; then echo 'Firewall logging enabled.' ! sysctl net.inet.ip.fw.verbose=1 >/dev/null fi } --- 66,72 ---- # if checkyesno firewall_logging; then echo 'Firewall logging enabled.' ! ${SYSCTL_W} net.inet.ip.fw.verbose=1 >/dev/null fi } *************** *** 63,72 **** { local _coscript # Start firewall coscripts # for _coscript in ${firewall_coscripts} ; do ! if [ -f "${_coscript}" ]; then ${_coscript} quietstart fi done --- 74,89 ---- { local _coscript + # stop proccessing if firewall is already running + # + [ ${_ipfw_running_status} -eq 1 ] && { + return 1; + } + # Start firewall coscripts # for _coscript in ${firewall_coscripts} ; do ! if [ -f "${_coscript}" -a -x "${_coscript}" ]; then ${_coscript} quietstart fi done *************** *** 98,110 **** # Stop firewall coscripts # for _coscript in `reverse_list ${firewall_coscripts}` ; do ! if [ -f "${_coscript}" ]; then ${_coscript} quietstop fi done } load_rc_config $name ! firewall_coscripts="/etc/rc.d/natd ${firewall_coscripts}" run_rc_command $* --- 115,132 ---- # Stop firewall coscripts # for _coscript in `reverse_list ${firewall_coscripts}` ; do ! if [ -f "${_coscript}" -a -x "${_coscript}" ]; then ${_coscript} quietstop fi done } load_rc_config $name ! ! if checkyesno firewall_nat_enable; then ! firewall_coscripts="/etc/rc.d/natd ${firewall_coscripts}" ! elif checkyesno natd_enable; then ! firewall_coscripts="/etc/rc.d/natd ${firewall_coscripts}" ! fi run_rc_command $*