NetBSD/etc/rc.d/npf

63 lines
831 B
Bash

#!/bin/sh
#
# $NetBSD: npf,v 1.2 2011/03/07 23:21:13 jmcneill Exp $
#
# Public Domain.
#
# PROVIDE: npf
# REQUIRE: root bootconf mountcritlocal tty network
# BEFORE: NETWORKING
$_rc_subr_loaded . /etc/rc.subr
name="npf"
rcvar=$name
config="/etc/npf.conf"
start_cmd="npf_start"
stop_cmd="npf_stop"
reload_cmd="npf_reload"
status_cmd="npf_status"
extra_commands="reload status"
npf_cfg_check()
{
if [ ! -f ${config} ]; then
warn "${config} is not readable; failed."
exit 1
fi
}
npf_start()
{
echo "Enabling NPF."
npf_cfg_check
/usr/sbin/npfctl reload
/usr/sbin/npfctl start
}
npf_stop()
{
echo "Disabling NPF."
/usr/sbin/npfctl stop
/usr/sbin/npfctl flush
}
npf_reload()
{
echo "Reloading NPF ruleset."
npf_cfg_check
/usr/sbin/npfctl reload
}
npf_status()
{
:
}
load_rc_config $name
run_rc_command "$1"