Cross Reference: pf
xref: /src/etc/rc.d/pf
  • Home
  • History
  • AnnotateAnnotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /src/etc/rc.d/
pf revision 1.1
11.1Sitojun#!/bin/sh
21.1Sitojun#
31.1Sitojun# $NetBSD: pf,v 1.1 2004/06/29 04:48:28 itojun Exp $
41.1Sitojun#
51.1Sitojun
61.1Sitojun# PROVIDE: pf
71.1Sitojun# REQUIRE: NETWORKING
81.1Sitojun# BEFORE: SERVERS
91.1Sitojun
101.1Sitojun. /etc/rc.subr
111.1Sitojun
121.1Sitojunname="pf"
131.1Sitojunrcvar=$name
141.1Sitojunstart_cmd="pf_start"
151.1Sitojunstop_cmd="pf_stop"
161.1Sitojunreload_cmd="pf_reload"
171.1Sitojunstatus_cmd="pf_status"
181.1Sitojunextra_commands="reload status"
191.1Sitojun
201.1Sitojunpf_start()
211.1Sitojun{
221.1Sitojun	echo "Enabling pf firewall."
231.1Sitojun	/sbin/pfctl -q -e 
241.1Sitojun	if [ -f /etc/pf.conf ]; then
251.1Sitojun		/sbin/pfctl -q -f /etc/pf.conf
261.1Sitojun	else
271.1Sitojun		warn "pf.conf not found; no pf rules loaded."
281.1Sitojun	fi
291.1Sitojun}
301.1Sitojun
311.1Sitojunpf_stop()
321.1Sitojun{
331.1Sitojun	echo "Disabling pf firewall."
341.1Sitojun	/sbin/pfctl -q -d
351.1Sitojun}
361.1Sitojun
371.1Sitojunpf_reload()
381.1Sitojun{
391.1Sitojun	echo "Reloading pf rules."
401.1Sitojun	if [ -f /etc/pf.conf ]; then
411.1Sitojun		/sbin/pfctl -q -f /etc/pf.conf
421.1Sitojun	else
431.1Sitojun		warn "pf.conf not found; no pf rules loaded."
441.1Sitojun	fi
451.1Sitojun}
461.1Sitojun
471.1Sitojunpf_status()
481.1Sitojun{
491.1Sitojun	/sbin/pfctl -s info
501.1Sitojun}
511.1Sitojun
521.1Sitojunload_rc_config $name
531.1Sitojunrun_rc_command "$1"
54

Indexes created Mon Nov 10 17:20:41 GMT 2025