NetBSD/etc/rc.d/npf

67 lines
897 B
Bash

#!/bin/sh
#
# $NetBSD: npf,v 1.6 2020/07/22 16:50:41 martin 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"