jow 524b8d3632 [packages] wide-dhcpv6: use network.sh to find devices
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31961 3c298f89-4303-0410-b956-a3cf2f4a3e73
2012-05-29 00:30:58 +00:00

38 lines
801 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2012 OpenWrt.org
SERVICE_USE_PID=1
start() {
[ ! -e /etc/dhcp6sctlkey ] && `dd if=/dev/urandom count=1 2> /dev/null | md5sum | cut -d" " -f1 > /etc/dhcp6sctlkey`
[ -e /var/run/dhcp6s.pid ] && return 0
. /lib/functions/network.sh
config_load "dhcp6s"
local enabled
config_get_bool enabled basic enabled 0
[ $enabled -eq 0 ] && return 0
logger starting dhcp6s
local server_interface server_ifname
config_get server_interface basic interface
network_get_device server_ifname "$server_interface" || return 1
local config_file
config_get config_file basic config_file
[ ! -e $config_file ] && return 1
service_start /usr/sbin/dhcp6s -c $config_file $server_ifname
}
stop() {
logger stopping dhcp6s
service_stop /usr/sbin/dhcp6s
}