NetBSD/etc/rc.d/npf

67 lines
896 B
Plaintext
Raw Normal View History

#!/bin/sh
#
# $NetBSD: npf,v 1.4 2019/04/19 18:36:25 leot 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
/sbin/npfctl reload
# The npf_boot script has enabled npf already.
if [ "$autoboot" != "yes" ]; then
/sbin/npfctl start
fi
}
npf_stop()
{
echo "Disabling NPF."
/sbin/npfctl stop
/sbin/npfctl flush
}
npf_reload()
{
echo "Reloading NPF ruleset."
npf_cfg_check
/sbin/npfctl reload
}
npf_status()
{
:
}
load_rc_config $name
run_rc_command "$1"