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