#!/sbin/runscript # Copyright 2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-pf/files/pf.initd,v 1.2 2007/02/23 13:51:44 uberlord Exp $ depend() { need net } checkconfig() { if ! [ -c /dev/pf ]; then ewarn "Pseudo-device /dev/pf not found." ebegin "Loading pf module" if ! kldload pf; then eerror "Unable to load pf module." eend 1 return 1 fi eend $? if ! [ -c /dev/pf ]; then eerror "Pseudo-device /dev/pf still not found." return 1 fi fi return 0 } start() { checkconfig || return 1 einfo "Starting firewall" if [ -r "${PF_RULES_FILE}" ]; then einfo "Loading firewall rules" /sbin/pfctl -qe -f ${PF_RULES_FILE:-/etc/pf.conf} ${PF_OPTS} else /sbin/pfctl -qe ${PF_OPTS} fi eend $? } stop() { einfo "Stopping firewall" /sbin/pfctl -qd || retval=1 eend $? }