xref: /freebsd/libexec/rc/rc.d/pfsync (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1#!/bin/sh
2#
3#
4
5# PROVIDE: pfsync
6# REQUIRE: FILESYSTEMS netif
7# KEYWORD: nojailvnet
8
9. /etc/rc.subr
10
11name="pfsync"
12desc="Packet filter state table sychronisation interface"
13rcvar="pfsync_enable"
14start_precmd="pfsync_prestart"
15start_cmd="pfsync_start"
16stop_cmd="pfsync_stop"
17required_modules="pf pfsync"
18
19pfsync_prestart()
20{
21	case "$pfsync_syncdev" in
22	'')
23		warn "pfsync_syncdev is not set."
24		return 1
25		;;
26	esac
27	return 0
28}
29
30pfsync_start()
31{
32	local _syncpeer
33
34	echo "Enabling pfsync."
35	if [ -n "${pfsync_syncpeer}" ]; then
36		_syncpeer="syncpeer ${pfsync_syncpeer}"
37	fi
38	ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up
39}
40
41pfsync_stop()
42{
43	echo "Disabling pfsync."
44	ifconfig pfsync0 -syncdev -syncpeer down
45}
46
47load_rc_config $name
48
49# doesn't make sense to run in a svcj: config setting
50pfsync_svcj="NO"
51
52run_rc_command "$1"
53