blob: cb822886d1b6fd5691da448b21f9bc1a988105a6 (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
# PROVIDE: ndproxy
# REQUIRE: NETWORKING sysctl
# KEYWORD: nojail
. /etc/rc.subr
name="ndproxy"
rcvar=ndproxy_enable
start_cmd="ndproxy_start"
stop_cmd="ndproxy_stop"
ndproxy_start()
{
echo "Starting ndproxy:"
sysctl net.inet6.ndproxyconf_uplink_interface > /dev/null 2>&1
if [ $? -eq 1 ]; then
kldload ndproxy > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo Failure loading ndproxy.
return;
fi
fi
sysctl net.inet6.ndproxycount=0
sysctl net.inet6.ndproxyconf_uplink_interface=${ndproxy_uplink_interface}
sysctl net.inet6.ndproxyconf_downlink_mac_address=${ndproxy_downlink_mac_address}
sysctl net.inet6.ndproxyconf_exception_ipv6_addresses=${ndproxy_exception_ipv6_addresses}
sysctl net.inet6.ndproxyconf_uplink_ipv6_addresses=${ndproxy_uplink_ipv6_addresses}
if [ -z "${ndproxy_uplink_interface}" ]; then
echo "Warning: ndproxy_uplink_interface should be defined in rc.conf (see ndproxy(4))."
fi
if [ -z "${ndproxy_downlink_mac_address}" ]; then
echo "Warning: ndproxy_downlink_mac_address should be defined in rc.conf (see ndproxy(4))."
fi
if [ -z "${ndproxy_uplink_ipv6_addresses}" ]; then
echo "Warning: ndproxy_uplink_ipv6_addresses should be defined in rc.conf (see ndproxy(4))."
fi
# Note that ndproxy_exception_ipv6_addresses may be left empty.
if [ -n "${ndproxy_uplink_interface}" ]; then
ifconfig ${ndproxy_uplink_interface} | head -1 | grep PPROMISC > /dev/null
if [ $? -eq 1 ]; then
echo "Putting interface ${ndproxy_uplink_interface} into permanently promiscuous mode."
ifconfig ${ndproxy_uplink_interface} promisc
fi
fi
echo Done.
}
ndproxy_stop()
{
echo "Stopping ndproxy:"
sysctl net.inet6.ndproxyconf_uplink_interface > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo Failure unloading ndproxy.
else
kldunload ndproxy > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo Failure unloading ndproxy.
else
echo Done.
fi
fi
}
load_rc_config $name
run_rc_command "$1"
|