You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
1.3 KiB

#!/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
}