head	1.8;
access;
symbols
	netbsd-11-0-RC4:1.8
	netbsd-11-0-RC3:1.8
	netbsd-11-0-RC2:1.8
	netbsd-11-0-RC1:1.8
	perseant-exfatfs-base-20250801:1.8
	netbsd-11:1.8.0.4
	netbsd-11-base:1.8
	netbsd-10-1-RELEASE:1.7.6.1
	perseant-exfatfs-base-20240630:1.8
	perseant-exfatfs:1.8.0.2
	perseant-exfatfs-base:1.8
	netbsd-8-3-RELEASE:1.3
	netbsd-9-4-RELEASE:1.4
	netbsd-10-0-RELEASE:1.7.6.1
	netbsd-10-0-RC6:1.7.6.1
	netbsd-10-0-RC5:1.7.6.1
	netbsd-10-0-RC4:1.7.6.1
	netbsd-10-0-RC3:1.7.6.1
	netbsd-10-0-RC2:1.7.6.1
	netbsd-10-0-RC1:1.7.6.1
	netbsd-10:1.7.0.6
	netbsd-10-base:1.7
	netbsd-9-3-RELEASE:1.4
	cjep_sun2x-base1:1.7
	cjep_sun2x:1.7.0.4
	cjep_sun2x-base:1.7
	cjep_staticlib_x-base1:1.7
	netbsd-9-2-RELEASE:1.4
	cjep_staticlib_x:1.7.0.2
	cjep_staticlib_x-base:1.7
	netbsd-9-1-RELEASE:1.4
	phil-wifi-20200421:1.4
	phil-wifi-20200411:1.4
	is-mlppp:1.4.0.4
	is-mlppp-base:1.4
	phil-wifi-20200406:1.4
	netbsd-8-2-RELEASE:1.3
	netbsd-9-0-RELEASE:1.4
	netbsd-9-0-RC2:1.4
	netbsd-9-0-RC1:1.4
	phil-wifi-20191119:1.4
	netbsd-9:1.4.0.2
	netbsd-9-base:1.4
	phil-wifi-20190609:1.4
	netbsd-8-1-RELEASE:1.3
	netbsd-8-1-RC1:1.3
	pgoyette-compat-merge-20190127:1.3
	pgoyette-compat-20190127:1.3
	pgoyette-compat-20190118:1.3
	pgoyette-compat-1226:1.3
	pgoyette-compat-1126:1.3
	pgoyette-compat-1020:1.3
	pgoyette-compat-0930:1.3
	pgoyette-compat-0906:1.3
	netbsd-7-2-RELEASE:1.3
	pgoyette-compat-0728:1.3
	netbsd-8-0-RELEASE:1.3
	phil-wifi:1.3.0.32
	phil-wifi-base:1.3
	pgoyette-compat-0625:1.3
	netbsd-8-0-RC2:1.3
	pgoyette-compat-0521:1.3
	pgoyette-compat-0502:1.3
	pgoyette-compat-0422:1.3
	netbsd-8-0-RC1:1.3
	pgoyette-compat-0415:1.3
	pgoyette-compat-0407:1.3
	pgoyette-compat-0330:1.3
	pgoyette-compat-0322:1.3
	pgoyette-compat-0315:1.3
	netbsd-7-1-2-RELEASE:1.3
	pgoyette-compat:1.3.0.30
	pgoyette-compat-base:1.3
	netbsd-7-1-1-RELEASE:1.3
	matt-nb8-mediatek:1.3.0.28
	matt-nb8-mediatek-base:1.3
	perseant-stdc-iso10646:1.3.0.26
	perseant-stdc-iso10646-base:1.3
	netbsd-8:1.3.0.24
	netbsd-8-base:1.3
	prg-localcount2-base3:1.3
	prg-localcount2-base2:1.3
	prg-localcount2-base1:1.3
	prg-localcount2:1.3.0.22
	prg-localcount2-base:1.3
	pgoyette-localcount-20170426:1.3
	bouyer-socketcan-base1:1.3
	pgoyette-localcount-20170320:1.3
	netbsd-7-1:1.3.0.20
	netbsd-7-1-RELEASE:1.3
	netbsd-7-1-RC2:1.3
	netbsd-7-nhusb-base-20170116:1.3
	bouyer-socketcan:1.3.0.18
	bouyer-socketcan-base:1.3
	pgoyette-localcount-20170107:1.3
	netbsd-7-1-RC1:1.3
	pgoyette-localcount-20161104:1.3
	netbsd-7-0-2-RELEASE:1.3
	localcount-20160914:1.3
	netbsd-7-nhusb:1.3.0.16
	netbsd-7-nhusb-base:1.3
	pgoyette-localcount-20160806:1.3
	pgoyette-localcount-20160726:1.3
	pgoyette-localcount:1.3.0.14
	pgoyette-localcount-base:1.3
	netbsd-7-0-1-RELEASE:1.3
	netbsd-7-0:1.3.0.12
	netbsd-7-0-RELEASE:1.3
	netbsd-7-0-RC3:1.3
	netbsd-7-0-RC2:1.3
	netbsd-7-0-RC1:1.3
	netbsd-6-0-6-RELEASE:1.2
	netbsd-6-1-5-RELEASE:1.2.6.1
	netbsd-7:1.3.0.10
	netbsd-7-base:1.3
	yamt-pagecache-base9:1.3
	yamt-pagecache-tag8:1.2.4.1
	netbsd-6-1-4-RELEASE:1.2.6.1
	netbsd-6-0-5-RELEASE:1.2
	tls-earlyentropy:1.3.0.8
	tls-earlyentropy-base:1.3
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.3
	riastradh-drm2-base3:1.3
	netbsd-6-1-3-RELEASE:1.2.6.1
	netbsd-6-0-4-RELEASE:1.2
	netbsd-6-1-2-RELEASE:1.2.6.1
	netbsd-6-0-3-RELEASE:1.2
	netbsd-6-1-1-RELEASE:1.2.6.1
	riastradh-drm2-base2:1.3
	riastradh-drm2-base1:1.3
	riastradh-drm2:1.3.0.2
	riastradh-drm2-base:1.3
	netbsd-6-1:1.2.6.1.0.2
	netbsd-6-0-2-RELEASE:1.2
	netbsd-6-1-RELEASE:1.2.6.1
	khorben-n900:1.3.0.6
	netbsd-6-1-RC4:1.2.6.1
	netbsd-6-1-RC3:1.2.6.1
	agc-symver:1.3.0.4
	agc-symver-base:1.3
	netbsd-6-1-RC2:1.2.6.1
	netbsd-6-1-RC1:1.2.6.1
	yamt-pagecache-base8:1.3
	netbsd-6-0-1-RELEASE:1.2
	yamt-pagecache-base7:1.3
	matt-nb6-plus-nbase:1.2
	yamt-pagecache-base6:1.2
	netbsd-6-0:1.2.0.12
	netbsd-6-0-RELEASE:1.2
	netbsd-6-0-RC2:1.2
	tls-maxphys:1.2.0.10
	tls-maxphys-base:1.3
	matt-nb6-plus:1.2.0.8
	matt-nb6-plus-base:1.2
	netbsd-6-0-RC1:1.2
	yamt-pagecache-base5:1.2
	yamt-pagecache-base4:1.2
	netbsd-6:1.2.0.6
	netbsd-6-base:1.2
	yamt-pagecache-base3:1.2
	yamt-pagecache-base2:1.2
	yamt-pagecache:1.2.0.4
	yamt-pagecache-base:1.2
	cherry-xenmp:1.2.0.2
	cherry-xenmp-base:1.2
	bouyer-quota2-base:1.1
	bouyer-quota2:1.1.0.2
	bouyer-quota2-nbase:1.1;
locks; strict;
comment	@# @;


1.8
date	2023.10.05.08.19.27;	author abs;	state Exp;
branches;
next	1.7;
commitid	AyMCQlAgB9SkCpHE;

1.7
date	2020.09.08.12.52.18;	author martin;	state Exp;
branches
	1.7.6.1;
next	1.6;
commitid	IL2vGNw0FVFgcfnC;

1.6
date	2020.07.22.16.50.41;	author martin;	state Exp;
branches;
next	1.5;
commitid	ZlFyZCKhX3U036hC;

1.5
date	2020.07.04.06.24.53;	author skrll;	state Exp;
branches;
next	1.4;
commitid	hRPK9EPvuxkZaJeC;

1.4
date	2019.04.19.18.36.25;	author leot;	state Exp;
branches;
next	1.3;
commitid	g4z41F6PHvHYpZjB;

1.3
date	2012.11.01.06.06.14;	author mrg;	state Exp;
branches
	1.3.32.1;
next	1.2;

1.2
date	2011.03.07.23.21.13;	author jmcneill;	state Exp;
branches
	1.2.4.1
	1.2.6.1
	1.2.10.1;
next	1.1;

1.1
date	2011.02.02.02.20.28;	author rmind;	state Exp;
branches
	1.1.2.1;
next	;

1.7.6.1
date	2023.10.13.18.04.49;	author martin;	state Exp;
branches;
next	;
commitid	OMMebGpDhpuABuIE;

1.3.32.1
date	2019.06.10.21.42.45;	author christos;	state Exp;
branches;
next	;
commitid	jtc8rnCzWiEEHGqB;

1.2.4.1
date	2013.01.16.05.26.13;	author yamt;	state Exp;
branches;
next	;

1.2.6.1
date	2012.11.29.00.09.44;	author riz;	state Exp;
branches;
next	;

1.2.10.1
date	2012.11.20.02.57.56;	author tls;	state Exp;
branches;
next	;

1.1.2.1
date	2011.02.02.02.20.28;	author bouyer;	state dead;
branches;
next	1.1.2.2;

1.1.2.2
date	2011.02.08.16.18.50;	author bouyer;	state Exp;
branches;
next	;


desc
@@


1.8
log
@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
@
text
@#!/bin/sh
#
# $NetBSD: npf,v 1.7 2020/09/08 12:52:18 martin Exp $
#
# Public Domain.
#

# PROVIDE: npf
# REQUIRE: root bootconf CRITLOCALMOUNTED tty network
# BEFORE: NETWORKING

$_rc_subr_loaded . /etc/rc.subr

name="npf"
rcvar=$name

start_cmd="npf_start"
stop_cmd="npf_stop"

reload_cmd="npf_reload"
status_cmd="npf_status"
extra_commands="reload status"


npf_start()
{
	echo "Enabling NPF $npf_rules"
	/sbin/npfctl reload "$npf_rules"

	# The npf_boot script has enabled npf already.
	if [ "$autoboot" != "yes" ]; then
		/sbin/npfctl start
	fi
}

npf_stop()
{
	echo "Disabling NPF."
	/sbin/npfctl stop
	/sbin/npfctl flush
}

npf_reload()
{
	echo "Reloading NPF ruleset $npf_rules"
	/sbin/npfctl reload "$npf_rules"
}

npf_status()
{
	:
}

load_rc_config $name
run_rc_command "$1"
@


1.7
log
@Rename MOUNTCRITLOCAL to CRITLOCALMOUNTED to avoid a name collision
on case insensitive file systems
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.6 2020/07/22 16:50:41 martin Exp $
a16 2
config="/etc/npf.conf"

a23 7
npf_cfg_check()
{
	if [ ! -f ${config} ]; then
		warn "${config} is not readable; failed."
		exit 1
	fi
}
d27 2
a28 3
	echo "Enabling NPF."
	npf_cfg_check
	/sbin/npfctl reload
d45 2
a46 3
	echo "Reloading NPF ruleset."
	npf_cfg_check
	/sbin/npfctl reload
@


1.7.6.1
log
@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
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.7 2020/09/08 12:52:18 martin Exp $
d17 2
d26 7
d36 3
a38 2
	echo "Enabling NPF $npf_rules"
	/sbin/npfctl reload "$npf_rules"
d55 3
a57 2
	echo "Reloading NPF ruleset $npf_rules"
	/sbin/npfctl reload "$npf_rules"
@


1.6
log
@Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.5 2020/07/04 06:24:53 skrll Exp $
d9 1
a9 1
# REQUIRE: root bootconf MOUNTCRITLOCAL tty network
@


1.5
log
@Trailing whitespace
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.4 2019/04/19 18:36:25 leot Exp $
d9 1
a9 1
# REQUIRE: root bootconf mountcritlocal tty network
@


1.4
log
@Do not start npf again at reboot (it is started via npf_boot)
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.3 2012/11/01 06:06:14 mrg Exp $
d30 1
a30 1
		exit 1	
@


1.3
log
@catch up with npfctl moving to /sbin.
untested, but i guess so was the move itself ;)
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.2 2011/03/07 23:21:13 jmcneill Exp $
d39 5
a43 1
	/sbin/npfctl start
@


1.3.32.1
log
@Sync with HEAD
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.4 2019/04/19 18:36:25 leot Exp $
d39 1
a39 5

	# The npf_boot script has enabled npf already.
	if [ "$autoboot" != "yes" ]; then
		/sbin/npfctl start
	fi
@


1.2
log
@put a : in an otherwise empty function, makes this script work with bash
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.1 2011/02/02 02:20:28 rmind Exp $
d38 2
a39 2
	/usr/sbin/npfctl reload
	/usr/sbin/npfctl start
d45 2
a46 2
	/usr/sbin/npfctl stop
	/usr/sbin/npfctl flush
d53 1
a53 1
	/usr/sbin/npfctl reload
@


1.2.4.1
log
@sync with (a bit old) head
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.2 2011/03/07 23:21:13 jmcneill Exp $
d38 2
a39 2
	/sbin/npfctl reload
	/sbin/npfctl start
d45 2
a46 2
	/sbin/npfctl stop
	/sbin/npfctl flush
d53 1
a53 1
	/sbin/npfctl reload
@


1.2.6.1
log
@Pull up following revision(s) (requested by rmind in ticket #726):
	etc/rc.d/npf: revision 1.3
	distrib/sets/lists/base/mi: revision 1.1010
	usr.sbin/npf/npfctl/Makefile: revision 1.9
	distrib/sets/lists/comp/mi: revision 1.1785
put in /sbin
catch up with npfctl moving to /sbin.
untested, but i guess so was the move itself ;)
mv npfctl from /usr/sbin to /sbin so it is available before /usr is mounted.
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.2 2011/03/07 23:21:13 jmcneill Exp $
d38 2
a39 2
	/sbin/npfctl reload
	/sbin/npfctl start
d45 2
a46 2
	/sbin/npfctl stop
	/sbin/npfctl flush
d53 1
a53 1
	/sbin/npfctl reload
@


1.2.10.1
log
@Resync to 2012-11-19 00:00:00 UTC
@
text
@d3 1
a3 1
# $NetBSD: npf,v 1.3 2012/11/01 06:06:14 mrg Exp $
d38 2
a39 2
	/sbin/npfctl reload
	/sbin/npfctl start
d45 2
a46 2
	/sbin/npfctl stop
	/sbin/npfctl flush
d53 1
a53 1
	/sbin/npfctl reload
@


1.1
log
@NPF checkpoint:
- Add libnpf(3) - a library to control NPF (configuration, ruleset, etc).
- Add NPF support for ftp-proxy(8).
- Add rc.d script for NPF.
- Convert npfctl(8) to use libnpf(3) and thus make it less depressive.
  Note: next clean-up step should be a parser, once dholland@@ will finish it.
- Add more documentation.
- Various fixes.
@
text
@d3 1
a3 1
# $NetBSD$
d58 1
@


1.1.2.1
log
@file npf was added on branch bouyer-quota2 on 2011-02-08 16:18:50 +0000
@
text
@d1 61
@


1.1.2.2
log
@Sync with HEAD
@
text
@a0 61
#!/bin/sh
#
# $NetBSD: npf,v 1.1 2011/02/02 02:20:28 rmind Exp $
#
# Public Domain.
#

# PROVIDE: npf
# REQUIRE: root bootconf mountcritlocal tty network
# BEFORE: NETWORKING

$_rc_subr_loaded . /etc/rc.subr

name="npf"
rcvar=$name

config="/etc/npf.conf"

start_cmd="npf_start"
stop_cmd="npf_stop"

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
	/usr/sbin/npfctl reload
	/usr/sbin/npfctl start
}

npf_stop()
{
	echo "Disabling NPF."
	/usr/sbin/npfctl stop
	/usr/sbin/npfctl flush
}

npf_reload()
{
	echo "Reloading NPF ruleset."
	npf_cfg_check
	/usr/sbin/npfctl reload
}

npf_status()
{
}

load_rc_config $name
run_rc_command "$1"
@


