summaryrefslogtreecommitdiff
path: root/net/dtcp/files/dtcps.in
blob: e996c3798fb6a36778007d45e2e8c8fd516e8ffe (plain) (blame)
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
54
55
56
57
#!/bin/sh

# PROVIDE: dtcps
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown

# Define these dtcps_* variables in one of these files:
#	/etc/rc.conf
#	/etc/rc.conf.local
#	/etc/rc.conf.d/dtcps
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
dtcps_enable=${dtcps_enable:-"NO"}		# Enable dtcps
# dtcps_program="%%PREFIX%%/sbin/dtcps"		# Location of dtcps
# dtcps_tunif=${dtcps_tunif:-""}		# tunnel interface
# dtcps_prefix=${dtcps_prefix:-""}		# prefix for host tunnel type
# dtcps_flags=${dtcps_flags:-""}		# Flags to dtcps program

# interface cloning example
#dtcps_tunif='gif70'

# static allocation example
#dtcps_unit_min=70
#dtcps_unit_max=79
#dtcps_tunif='gif7[0-9]'

# prefix for host tunnel type.
# YOU MUST CHANGE TO ASSIGN THIS WITHIN YOUR ADDRESS BLOCK.
#dtcps_prefix='3ffe:501:185b:8000::'

. /etc/rc.subr

name="dtcps"
rcvar=dtcps_enable
command="%%PREFIX%%/sbin/${name}"
command_interpreter="%%RUBY%%"
pidfile="/var/run/${name}.pid"
start_precmd="dtcps_prestart"

dtcps_prestart() {
	if [ -n "${dtcps_unit_min}" -a -n "${dtcps_unit_max}" ]; then
		unit=${dtcps_unit_min}
		while [ ${unit} -le ${dtcps_unit_max} ]; do
			ifconfig gif${unit} create >/dev/null 2>&1
			unit=$((${unit}+1))
		done
	fi
}

load_rc_config $name
command_args="-i ${dtcps_tunif} ${dtcps_prefix}"
if [ -n "${dtcps_fib}" ]; then
	command_args="-F ${dtcps_fib} ${command_args}"
fi
run_rc_command "$1"