blob: e8f3d92c096e6e1d346a11d13c09d8979d998a02 [file] [log] [blame]
#!/sbin/runscript
# Copyright 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
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 $?
}