pfsync revision 168531
155077Sache#!/bin/sh
255077Sache#
355077Sache# $FreeBSD: head/etc/rc.d/pfsync 168531 2007-04-09 08:53:40Z des $
455077Sache#
5174990Sache
655077Sache# PROVIDE: pfsync
755077Sache# REQUIRE: FILESYSTEMS netif
855077Sache# KEYWORD: nojail
955077Sache
1055077Sache. /etc/rc.subr
1155077Sache
1255077Sachename="pfsync"
1355077Sachercvar=`set_rcvar`
1455077Sachestart_precmd="pfsync_prestart"
1555077Sachestart_cmd="pfsync_start"
1655077Sachestop_cmd="pfsync_stop"
1755077Sacherequired_modules="pf"
1855077Sache
1955077Sachepfsync_prestart()
20174990Sache{
2155077Sache	# XXX Currently pfsync cannot be a module as it must register
2255077Sache	# a network protocol in a static kernel table.
2355077Sache	if ! kldstat -q -m pfsync; then
2455077Sache		warn "pfsync(4) must be statically compiled in the kernel."
2555077Sache		return 1
2655077Sache	fi
2755077Sache
2855077Sache	case "$pfsync_syncdev" in
2955077Sache	'')
3055077Sache		warn "pfsync_syncdev is not set."
3155077Sache		return 1
3255077Sache		;;
3355077Sache	esac
3455077Sache	return 0
3555077Sache}
3655077Sache
3774606Sachepfsync_start()
3874606Sache{
3974606Sache	echo "Enabling pfsync."
4074606Sache	ifconfig pfsync0 syncdev $pfsync_syncdev $pfsync_ifconfig up
4174606Sache}
4274606Sache
4374606Sachepfsync_stop()
4474606Sache{
4555077Sache	echo "Disabling pfsync."
4655077Sache	ifconfig pfsync0 -syncdev down
4755077Sache}
4855077Sache
4955077Sacheload_rc_config $name
5055077Sacherun_rc_command "$1"
5155077Sache