blob: 17f079bd900c1796ec9501d05f65f35275f8d6d2 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: vboxnet
# REQUIRE: FILESYSTEMS
# BEFORE: netif
# KEYWORD: nojail
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# vboxnet_enable (bool): Set to NO by default.
# Set it to YES to load network related kernel modules on startup
. /etc/rc.subr
name="vboxnet"
rcvar=${name}_enable
start_cmd="vboxnet_start"
stop_cmd="vboxnet_stop"
vboxnet_start()
{
if ! kldstat -q -m ng_vboxnetflt;
then
if ! kldload vboxnetflt > /dev/null 2>&1;
then
warn "Can't load vboxnetflt module."
return 1
fi
fi
if ! kldstat -q -m vboxnetadp;
then
if ! kldload vboxnetadp > /dev/null 2>&1;
then
warn "Can't load vboxnetadp module."
return 1
fi
fi
}
vboxnet_stop()
{
if kldstat -q -m vboxnetadp;
then
if ! kldunload vboxnetadp > /dev/null 2>&1;
then
warn "Can't unload vboxnetadp module."
return 1
fi
fi
if kldstat -q -m ng_vboxnetflt;
then
if ! kldunload vboxnetflt > /dev/null 2>&1;
then
warn "Can't unload vboxnetflt module."
return 1
fi
fi
}
load_rc_config $name
: ${vboxnet_enable="NO"}
run_rc_command "$1"
|