#!/bin/sh
#
# $NetBSD: npf,v 1.8 2023/10/05 08:19:27 abs Exp $
#
# Public Domain.
#

# PROVIDE: npf
# REQUIRE: root bootconf CRITLOCALMOUNTED tty network
# BEFORE: NETWORKING

$_rc_subr_loaded . /etc/rc.subr

name="npf"
rcvar=$name

start_cmd="npf_start"
stop_cmd="npf_stop"

reload_cmd="npf_reload"
status_cmd="npf_status"
extra_commands="reload status"


npf_start()
{
       echo "Enabling NPF $npf_rules"
       /sbin/npfctl reload "$npf_rules"

       # 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_rules"
       /sbin/npfctl reload "$npf_rules"
}

npf_status()
{
       :
}

load_rc_config $name
run_rc_command "$1"