Pull up following revision(s) (requested by sevan in ticket #288): etc/rc.d/npf_boot: revision 1.2 etc/rc.d/pf_boot: revision 1.5 No need to empose the script to be runnable during boot time, it prevents the script from wroking if the system is booted into single user mode & then moved onto multi-user mode. Reported by <pgoyette> for NPF but the issue is there in PF too.diff -r1.1 -r1.1.4.1 src/etc/rc.d/npf_boot
(martin)
--- src/etc/rc.d/npf_boot 2019/04/02 01:50:32 1.1
+++ src/etc/rc.d/npf_boot 2019/10/06 11:13:35 1.1.4.1
@@ -1,35 +1,31 @@ | @@ -1,35 +1,31 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh | |
2 | # | 2 | # | |
3 | # $NetBSD: npf_boot,v 1.1 2019/04/02 01:50:32 sevan Exp $ | 3 | # $NetBSD: npf_boot,v 1.1.4.1 2019/10/06 11:13:35 martin Exp $ | |
4 | # | 4 | # | |
5 | 5 | |||
6 | # PROVIDE: npf_boot | 6 | # PROVIDE: npf_boot | |
7 | # REQUIRE: root bootconf mountcritlocal tty | 7 | # REQUIRE: root bootconf mountcritlocal tty | |
8 | # BEFORE: network | 8 | # BEFORE: network | |
9 | 9 | |||
10 | $_rc_subr_loaded . /etc/rc.subr | 10 | $_rc_subr_loaded . /etc/rc.subr | |
11 | 11 | |||
12 | name="npf_boot" | 12 | name="npf_boot" | |
13 | rcvar="npf" | 13 | rcvar="npf" | |
14 | start_cmd="npf_boot_start" | 14 | start_cmd="npf_boot_start" | |
15 | stop_cmd=":" | 15 | stop_cmd=":" | |
16 | 16 | |||
17 | npf_boot_start() | 17 | npf_boot_start() | |
18 | { | 18 | { | |
19 | if [ "$autoboot" != "yes" ]; then | |||
20 | err 1 "This script should only be executed at boot time." | |||
21 | fi | |||
22 | ||||
23 | if [ -f /etc/npf.boot.conf ]; then | 19 | if [ -f /etc/npf.boot.conf ]; then | |
24 | /sbin/npfctl reload /etc/npf.boot.conf | 20 | /sbin/npfctl reload /etc/npf.boot.conf | |
25 | elif [ -f /etc/defaults/npf.boot.conf ]; then | 21 | elif [ -f /etc/defaults/npf.boot.conf ]; then | |
26 | /sbin/npfctl reload /etc/defaults/npf.boot.conf | 22 | /sbin/npfctl reload /etc/defaults/npf.boot.conf | |
27 | else | 23 | else | |
28 | warn "can't load initial npf rules; npf start aborted." | 24 | warn "can't load initial npf rules; npf start aborted." | |
29 | stop_boot | 25 | stop_boot | |
30 | exit 1 | 26 | exit 1 | |
31 | fi | 27 | fi | |
32 | 28 | |||
33 | /sbin/npfctl start | 29 | /sbin/npfctl start | |
34 | } | 30 | } | |
35 | 31 |
--- src/etc/rc.d/pf_boot 2008/11/22 20:23:33 1.4
+++ src/etc/rc.d/pf_boot 2019/10/06 11:13:35 1.4.52.1
@@ -1,35 +1,31 @@ | @@ -1,35 +1,31 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh | |
2 | # | 2 | # | |
3 | # $NetBSD: pf_boot,v 1.4 2008/11/22 20:23:33 tsutsui Exp $ | 3 | # $NetBSD: pf_boot,v 1.4.52.1 2019/10/06 11:13:35 martin Exp $ | |
4 | # | 4 | # | |
5 | 5 | |||
6 | # PROVIDE: pf_boot | 6 | # PROVIDE: pf_boot | |
7 | # REQUIRE: root bootconf mountcritlocal tty | 7 | # REQUIRE: root bootconf mountcritlocal tty | |
8 | # BEFORE: network | 8 | # BEFORE: network | |
9 | 9 | |||
10 | $_rc_subr_loaded . /etc/rc.subr | 10 | $_rc_subr_loaded . /etc/rc.subr | |
11 | 11 | |||
12 | name="pf_boot" | 12 | name="pf_boot" | |
13 | rcvar="pf" | 13 | rcvar="pf" | |
14 | start_cmd="pf_boot_start" | 14 | start_cmd="pf_boot_start" | |
15 | stop_cmd=":" | 15 | stop_cmd=":" | |
16 | 16 | |||
17 | pf_boot_start() | 17 | pf_boot_start() | |
18 | { | 18 | { | |
19 | if [ "$autoboot" != "yes" ]; then | |||
20 | err 1 "This script should only be executed at boot time." | |||
21 | fi | |||
22 | ||||
23 | if [ -f /etc/pf.boot.conf ]; then | 19 | if [ -f /etc/pf.boot.conf ]; then | |
24 | /sbin/pfctl -q -f /etc/pf.boot.conf | 20 | /sbin/pfctl -q -f /etc/pf.boot.conf | |
25 | elif [ -f /etc/defaults/pf.boot.conf ]; then | 21 | elif [ -f /etc/defaults/pf.boot.conf ]; then | |
26 | /sbin/pfctl -q -f /etc/defaults/pf.boot.conf | 22 | /sbin/pfctl -q -f /etc/defaults/pf.boot.conf | |
27 | else | 23 | else | |
28 | warn "can't load initial pf rules; pf start aborted." | 24 | warn "can't load initial pf rules; pf start aborted." | |
29 | stop_boot | 25 | stop_boot | |
30 | exit 1 | 26 | exit 1 | |
31 | fi | 27 | fi | |
32 | 28 | |||
33 | /sbin/pfctl -q -e | 29 | /sbin/pfctl -q -e | |
34 | } | 30 | } | |
35 | 31 |