2011-02-02 05:20:24 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2012-11-01 10:06:14 +04:00
|
|
|
# $NetBSD: npf,v 1.3 2012/11/01 06:06:14 mrg Exp $
|
2011-02-02 05:20:24 +03:00
|
|
|
#
|
|
|
|
# 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
|
2012-11-01 10:06:14 +04:00
|
|
|
/sbin/npfctl reload
|
|
|
|
/sbin/npfctl start
|
2011-02-02 05:20:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
npf_stop()
|
|
|
|
{
|
|
|
|
echo "Disabling NPF."
|
2012-11-01 10:06:14 +04:00
|
|
|
/sbin/npfctl stop
|
|
|
|
/sbin/npfctl flush
|
2011-02-02 05:20:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
npf_reload()
|
|
|
|
{
|
|
|
|
echo "Reloading NPF ruleset."
|
|
|
|
npf_cfg_check
|
2012-11-01 10:06:14 +04:00
|
|
|
/sbin/npfctl reload
|
2011-02-02 05:20:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
npf_status()
|
|
|
|
{
|
2011-03-08 02:21:13 +03:00
|
|
|
:
|
2011-02-02 05:20:24 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|