diff options
author | yar <yar@FreeBSD.org> | 2005-10-02 18:59:02 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2005-10-02 18:59:02 +0000 |
commit | 327895a26d00e4a20e74f7f0f563dbda350408fa (patch) | |
tree | 06f160b8333b1fa086d351d997b7534badaf42fb /etc/rc.d/pfsync | |
parent | 57ff4e8e87ba086a7cc0b2bb654094221fa7ed55 (diff) | |
download | FreeBSD-src-327895a26d00e4a20e74f7f0f563dbda350408fa.zip FreeBSD-src-327895a26d00e4a20e74f7f0f563dbda350408fa.tar.gz |
Add an rc.d script to start pfsync at the right moment of the
system boot, and hook it up in the system.
The separate script is needed because in the presence of various
interface lists in rc.conf ($network_interfaces, $cloned_interfaces,
$sppp_interfaces, $gif_interfaces, more to come) it is hard to start
them orderly, so that pfsync is brought up after its syncdev, which
is required for the proper startup of pfsync.
Discussed with: mlaier on -pf
MFC after: 5 days
Diffstat (limited to 'etc/rc.d/pfsync')
-rw-r--r-- | etc/rc.d/pfsync | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/etc/rc.d/pfsync b/etc/rc.d/pfsync new file mode 100644 index 0000000..8d49042 --- /dev/null +++ b/etc/rc.d/pfsync @@ -0,0 +1,53 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: pfsync +# REQUIRE: root mountcritlocal netif +# KEYWORD: nojail + +. /etc/rc.subr + +name="pfsync" +rcvar=`set_rcvar` +start_precmd="pfsync_prestart" +start_cmd="pfsync_start" +stop_cmd="pfsync_stop" + +pfsync_prestart() +{ + case "$pfsync_syncdev" in + '') + warn "pfsync_syncdev is not set." + return 1 + ;; + esac + + # load pf kernel module if needed + if ! kldstat -q -m pf ; then + if kldload pf ; then + info "pf module loaded." + else + warn "pf module failed to load." + return 1 + fi + fi + + return 0 +} + +pfsync_start() +{ + echo "Enabling pfsync." + ifconfig pfsync0 syncdev $pfsync_syncdev $pfsync_ifconfig up +} + +pfsync_stop() +{ + echo "Disabling pfsync." + ifconfig pfsync0 -syncdev down +} + +load_rc_config $name +run_rc_command "$1" |