xref: /freebsd/libexec/rc/rc.d/pfsync (revision f99f0ee14e3af81c23150a6a340259ca8a33d01a)
10696600cSBjoern A. Zeeb#!/bin/sh
20696600cSBjoern A. Zeeb#
30696600cSBjoern A. Zeeb#
40696600cSBjoern A. Zeeb
50696600cSBjoern A. Zeeb# PROVIDE: pfsync
60696600cSBjoern A. Zeeb# REQUIRE: FILESYSTEMS netif
70696600cSBjoern A. Zeeb# KEYWORD: nojailvnet
80696600cSBjoern A. Zeeb
90696600cSBjoern A. Zeeb. /etc/rc.subr
100696600cSBjoern A. Zeeb
110696600cSBjoern A. Zeebname="pfsync"
120696600cSBjoern A. Zeebdesc="Packet filter state table sychronisation interface"
130696600cSBjoern A. Zeebrcvar="pfsync_enable"
140696600cSBjoern A. Zeebstart_precmd="pfsync_prestart"
150696600cSBjoern A. Zeebstart_cmd="pfsync_start"
160696600cSBjoern A. Zeebstop_cmd="pfsync_stop"
170696600cSBjoern A. Zeebrequired_modules="pf pfsync"
180696600cSBjoern A. Zeeb
190696600cSBjoern A. Zeebpfsync_prestart()
200696600cSBjoern A. Zeeb{
210696600cSBjoern A. Zeeb	case "$pfsync_syncdev" in
220696600cSBjoern A. Zeeb	'')
230696600cSBjoern A. Zeeb		warn "pfsync_syncdev is not set."
240696600cSBjoern A. Zeeb		return 1
250696600cSBjoern A. Zeeb		;;
260696600cSBjoern A. Zeeb	esac
270696600cSBjoern A. Zeeb	return 0
280696600cSBjoern A. Zeeb}
290696600cSBjoern A. Zeeb
300696600cSBjoern A. Zeebpfsync_start()
310696600cSBjoern A. Zeeb{
320696600cSBjoern A. Zeeb	local _syncpeer
330696600cSBjoern A. Zeeb
340696600cSBjoern A. Zeeb	echo "Enabling pfsync."
350696600cSBjoern A. Zeeb	if [ -n "${pfsync_syncpeer}" ]; then
360696600cSBjoern A. Zeeb		_syncpeer="syncpeer ${pfsync_syncpeer}"
370696600cSBjoern A. Zeeb	fi
380696600cSBjoern A. Zeeb	ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up
390696600cSBjoern A. Zeeb}
400696600cSBjoern A. Zeeb
410696600cSBjoern A. Zeebpfsync_stop()
420696600cSBjoern A. Zeeb{
430696600cSBjoern A. Zeeb	echo "Disabling pfsync."
440696600cSBjoern A. Zeeb	ifconfig pfsync0 -syncdev -syncpeer down
450696600cSBjoern A. Zeeb}
460696600cSBjoern A. Zeeb
470696600cSBjoern A. Zeebload_rc_config $name
48*f99f0ee1SAlexander Leidinger
49*f99f0ee1SAlexander Leidinger# doesn't make sense to run in a svcj: config setting
50*f99f0ee1SAlexander Leidingerpfsync_svcj="NO"
51*f99f0ee1SAlexander Leidinger
520696600cSBjoern A. Zeebrun_rc_command "$1"
53