xref: /netbsd-src/etc/rc.d/npf (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
1#!/bin/sh
2#
3# $NetBSD: npf,v 1.7 2020/09/08 12:52:18 martin Exp $
4#
5# Public Domain.
6#
7
8# PROVIDE: npf
9# REQUIRE: root bootconf CRITLOCALMOUNTED tty network
10# BEFORE: NETWORKING
11
12$_rc_subr_loaded . /etc/rc.subr
13
14name="npf"
15rcvar=$name
16
17config="/etc/npf.conf"
18
19start_cmd="npf_start"
20stop_cmd="npf_stop"
21
22reload_cmd="npf_reload"
23status_cmd="npf_status"
24extra_commands="reload status"
25
26npf_cfg_check()
27{
28	if [ ! -f ${config} ]; then
29		warn "${config} is not readable; failed."
30		exit 1
31	fi
32}
33
34npf_start()
35{
36	echo "Enabling NPF."
37	npf_cfg_check
38	/sbin/npfctl reload
39
40	# The npf_boot script has enabled npf already.
41	if [ "$autoboot" != "yes" ]; then
42		/sbin/npfctl start
43	fi
44}
45
46npf_stop()
47{
48	echo "Disabling NPF."
49	/sbin/npfctl stop
50	/sbin/npfctl flush
51}
52
53npf_reload()
54{
55	echo "Reloading NPF ruleset."
56	npf_cfg_check
57	/sbin/npfctl reload
58}
59
60npf_status()
61{
62	:
63}
64
65load_rc_config $name
66run_rc_command "$1"
67