Home | History | Annotate | Line # | Download | only in rc.d
npf revision 1.1
      1 #!/bin/sh
      2 #
      3 # $NetBSD: npf,v 1.1 2011/02/02 02:20:28 rmind Exp $
      4 #
      5 # Public Domain.
      6 #
      7 
      8 # PROVIDE: npf
      9 # REQUIRE: root bootconf mountcritlocal tty network
     10 # BEFORE: NETWORKING
     11 
     12 $_rc_subr_loaded . /etc/rc.subr
     13 
     14 name="npf"
     15 rcvar=$name
     16 
     17 config="/etc/npf.conf"
     18 
     19 start_cmd="npf_start"
     20 stop_cmd="npf_stop"
     21 
     22 reload_cmd="npf_reload"
     23 status_cmd="npf_status"
     24 extra_commands="reload status"
     25 
     26 npf_cfg_check()
     27 {
     28 	if [ ! -f ${config} ]; then
     29 		warn "${config} is not readable; failed."
     30 		exit 1	
     31 	fi
     32 }
     33 
     34 npf_start()
     35 {
     36 	echo "Enabling NPF."
     37 	npf_cfg_check
     38 	/usr/sbin/npfctl reload
     39 	/usr/sbin/npfctl start
     40 }
     41 
     42 npf_stop()
     43 {
     44 	echo "Disabling NPF."
     45 	/usr/sbin/npfctl stop
     46 	/usr/sbin/npfctl flush
     47 }
     48 
     49 npf_reload()
     50 {
     51 	echo "Reloading NPF ruleset."
     52 	npf_cfg_check
     53 	/usr/sbin/npfctl reload
     54 }
     55 
     56 npf_status()
     57 {
     58 }
     59 
     60 load_rc_config $name
     61 run_rc_command "$1"
     62