blob: a80b6ed1d5feae134a2020af73c76e14f3a1b187 (
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
|
#!/bin/sh /etc/rc.common
START=50
USE_PROCD=1
ARGS=""
append_prefix_off_link() {
ARGS="$ARGS -a $1"
}
append_prefix_on_link() {
ARGS="$ARGS -p $1"
}
append_dns() {
ARGS="$ARGS --rdnss $1"
}
start_instance() {
local cfg="$1" enabled device ifname default_lifetime
ARGS=""
config_get_bool enabled $cfg 'enabled' 1
config_get device $cfg 'device'
config_get ifname $cfg 'ifname'
config_get default_lifetime $cfg 'default_lifetime'
if [ "$enabled" != "1" ]; then
exit 0
fi
if [ -n "$device" ] && [ -n "$ifname" ]; then
echo "either set device or ifname" >&2
exit 1
fi
if [ -z "$device" ] && [ -z "$ifname" ]; then
echo "either set device or ifname" >&2
exit 1
fi
if [ -z "$ifname" ]; then
network_get_device 'ifname' "$ifname"
fi
if [ -z "$ifname" ]; then
echo "no valid device or ifname set" >&2
exit 1
fi
if [ -n "$default_lifetime" ]; then
ARGS="$ARGS --default-lifetime $default_lifetime"
fi
ARGS="$ARGS -i $ifname"
config_list_foreach $cfg 'prefix_off_link' append_prefix_off_link
config_list_foreach $cfg 'prefix_on_link' append_prefix_on_link
config_list_foreach $cfg "dns" append_dns
procd_open_instance
procd_set_param command /usr/sbin/uradvd $ARGS
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load uradvd
config_foreach start_instance interface
}
|