Module Name:    src
Committed By:   martin
Date:           Fri Oct 13 18:04:49 UTC 2023

Modified Files:
        src/etc/defaults [netbsd-10]: rc.conf
        src/etc/rc.d [netbsd-10]: npf

Log Message:
Pull up following revision(s) (requested by abs in ticket #404):

        etc/rc.d/npf: revision 1.8
        etc/defaults/rc.conf: revision 1.167

Add support to npf_rules to rc.conf
- Allows overriding default from /etc/npf.conf
- Indicate rules file used in output
- Drop check for file presence in script - rely on npf exiting with error


To generate a diff of this commit:
cvs rdiff -u -r1.162.2.2 -r1.162.2.3 src/etc/defaults/rc.conf
cvs rdiff -u -r1.7 -r1.7.6.1 src/etc/rc.d/npf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.162.2.2 src/etc/defaults/rc.conf:1.162.2.3
--- src/etc/defaults/rc.conf:1.162.2.2	Mon Oct  2 13:26:04 2023
+++ src/etc/defaults/rc.conf	Fri Oct 13 18:04:49 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.162.2.2 2023/10/02 13:26:04 martin Exp $
+#	$NetBSD: rc.conf,v 1.162.2.3 2023/10/13 18:04:49 martin Exp $
 #
 # /etc/defaults/rc.conf --
 #	default configuration of /etc/rc.conf
@@ -181,7 +181,7 @@ securelevel=""					# securelevel to set 
 ifconfig_wait_dad_flags="-w 15 -W 5"
 
 mdnsd=NO
-npf=NO
+npf=NO			npf_rules="/etc/npf.conf"
 npfd=NO			npfd_flags=""
 ipfilter=NO		ipfilter_flags=""	# uses /etc/ipf.conf
 ipnat=NO					# uses /etc/ipnat.conf

Index: src/etc/rc.d/npf
diff -u src/etc/rc.d/npf:1.7 src/etc/rc.d/npf:1.7.6.1
--- src/etc/rc.d/npf:1.7	Tue Sep  8 12:52:18 2020
+++ src/etc/rc.d/npf	Fri Oct 13 18:04:49 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: npf,v 1.7 2020/09/08 12:52:18 martin Exp $
+# $NetBSD: npf,v 1.7.6.1 2023/10/13 18:04:49 martin Exp $
 #
 # Public Domain.
 #
@@ -14,8 +14,6 @@ $_rc_subr_loaded . /etc/rc.subr
 name="npf"
 rcvar=$name
 
-config="/etc/npf.conf"
-
 start_cmd="npf_start"
 stop_cmd="npf_stop"
 
@@ -23,19 +21,11 @@ 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
+	echo "Enabling NPF $npf_rules"
+	/sbin/npfctl reload "$npf_rules"
 
 	# The npf_boot script has enabled npf already.
 	if [ "$autoboot" != "yes" ]; then
@@ -52,9 +42,8 @@ npf_stop()
 
 npf_reload()
 {
-	echo "Reloading NPF ruleset."
-	npf_cfg_check
-	/sbin/npfctl reload
+	echo "Reloading NPF ruleset $npf_rules"
+	/sbin/npfctl reload "$npf_rules"
 }
 
 npf_status()

Reply via email to