summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/pfsync
blob: 8d490421c163d784dc69ef05ca7c129038a38b1c (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
50
51
52
53
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: pfsync
# REQUIRE: root mountcritlocal netif
# KEYWORD: nojail

. /etc/rc.subr

name="pfsync"
rcvar=`set_rcvar`
start_precmd="pfsync_prestart"
start_cmd="pfsync_start"
stop_cmd="pfsync_stop"

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

	# load pf kernel module if needed
	if ! kldstat -q -m pf ; then
		if kldload pf ; then
			info "pf module loaded."
		else
			warn "pf module failed to load."
			return 1
		fi
	fi

	return 0
}

pfsync_start()
{
	echo "Enabling pfsync."
	ifconfig pfsync0 syncdev $pfsync_syncdev $pfsync_ifconfig up
}

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

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud