Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Changes suggested by lukem:



details:   https://anonhg.NetBSD.org/src/rev/1158aa345ee5
branches:  trunk
changeset: 583524:1158aa345ee5
user:      peter <peter%NetBSD.org@localhost>
date:      Wed Aug 10 13:52:05 2005 +0000

description:
Changes suggested by lukem:

1. Order pf to start before the network is configured.

2. If the pf_rules cannot be found at boot time, abort the boot (from the
   ipfilter script).

diffstat:

 etc/rc.d/pf |  24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 578fb1471f4c -r 1158aa345ee5 etc/rc.d/pf
--- a/etc/rc.d/pf       Wed Aug 10 13:23:38 2005 +0000
+++ b/etc/rc.d/pf       Wed Aug 10 13:52:05 2005 +0000
@@ -1,22 +1,40 @@
 #!/bin/sh
 #
-# $NetBSD: pf,v 1.4 2005/08/07 01:03:39 peter Exp $
+# $NetBSD: pf,v 1.5 2005/08/10 13:52:05 peter Exp $
 #
 
 # PROVIDE: pf
-# REQUIRE: NETWORKING
-# BEFORE: SERVERS
+# REQUIRE: root beforenetlkm mountcritlocal tty
+# BEFORE: network
 
 $_rc_subr_loaded . /etc/rc.subr
 
 name="pf"
 rcvar=$name
+start_precmd="pf_prestart"
 start_cmd="pf_start"
 stop_cmd="pf_stop"
 reload_cmd="pf_reload"
 status_cmd="pf_status"
 extra_commands="reload status"
 
+pf_prestart()
+{
+       if [ ! -f ${pf_rules} ]; then
+               warn "${pf_rules} not readable; pf start aborted."
+
+               # If booting directly to multiuser, send SIGTERM to
+               # the parent (/etc/rc) to abort the boot
+               if [ "$autoboot" = yes ]; then
+                       echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
+                       kill -TERM $$
+                       exit 1
+               fi
+               return 1
+       fi
+       return 0
+}
+
 pf_start()
 {
        echo "Enabling pf firewall."



Home | Main Index | Thread Index | Old Index