summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/pfsync
blob: 3c46575e39b1383bd8d2a2352473daf05168c497 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: pfsync
# REQUIRE: FILESYSTEMS netif
# KEYWORD: nojail

. /etc/rc.subr

name="pfsync"
rcvar="pfsync_enable"
start_precmd="pfsync_prestart"
start_cmd="pfsync_start"
stop_cmd="pfsync_stop"
required_modules="pf"

pfsync_prestart()
{
	case "$pfsync_syncdev" in
	'')
		warn "pfsync_syncdev is not set."
		return 1
		;;
	esac
	return 0
}

pfsync_start()
{
	local _syncpeer

	echo "Enabling pfsync."
	if [ -n "${pfsync_syncpeer}" ]; then
		_syncpeer="syncpeer ${pfsync_syncpeer}"
	fi
	load_kld pfsync
	ifconfig pfsync0 $_syncpeer syncdev $pfsync_syncdev $pfsync_ifconfig up
}

pfsync_stop()
{
	echo "Disabling pfsync."
	ifconfig pfsync0 -syncdev -syncpeer down
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud