#
-# Copyright (C) 2010-2011 OpenWrt.org
+# Copyright (C) 2010-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
PKG_NAME:=wide-dhcpv6
PKG_VERSION:=20080615
-PKG_RELEASE:=10
+PKG_RELEASE:=11
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
DHCP6C_REQUEST_OPTIONS='domain_name_servers domain_name ntp_servers sip_server_address sip_domain_name nis_server_address nis_domain_name nisp_server_address nisp_domain_name bcmcs_server_address bcmcs_domain_name'
-get_ifname() {
- local interface=$1
- local ifname
- scan_interfaces
- config_get ifname "$interface" ifname
- printf '%s\n' "$ifname"
- return 0
-}
-
-get_device() {
- local interface=$1
- local ifname=$2
- local device
- scan_interfaces
- config_get device "$interface" device
- grep -qE "^ *$device:" /proc/net/dev && \
- printf '%s\n' "$device" || \
- printf '%s\n' "$ifname"
- return 0
-}
-
dhcp6c_write_duid() {
local mac="${1:-$(ifconfig "$client_device" | sed -ne 's/[[:space:]]*$//; s/.*HWaddr //p')}"
local pat="[0-9A-F][0-9A-F]"
local sla_id
local sla_len
local enabled
+ local device
config_get_bool enabled "$cfg" enabled 0
config_get sla_id "$cfg" sla_id
config_get sla_len "$cfg" sla_len
- printf '\tprefix-interface %s {\n' "$(get_ifname $cfg)"
- printf '\t\tsla-id %s;\n' "$sla_id"
- printf '\t\tsla-len %s;\n' "$sla_len"
- printf '\t};\n'
+ network_get_device device "$cfg" && {
+ printf '\tprefix-interface %s {\n' "$device"
+ printf '\t\tsla-id %s;\n' "$sla_id"
+ printf '\t\tsla-len %s;\n' "$sla_len"
+ printf '\t};\n'
+ }
fi
}
[ -e /var/run/dhcp6c.pid ] && return 0
- include /lib/network
+ . /lib/functions/network.sh
config_load "dhcp6c"
logger -t dhcp6c starting dhcp6c
- local client_interface
+ local client_interface client_ifname client_device
config_get client_interface basic interface
- local client_ifname=$(get_ifname "$client_interface")
- local client_device=$(get_device "$client_interface" "$client_ifname")
+ network_get_device client_ifname "$client_interface"
+ network_get_physdev client_device "$client_interface" || client_device="$client_ifname"
local config_file="/var/etc/dhcp6c.conf"
local duid_file="/var/dhcp6c_duid"
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2010-2011 OpenWrt.org
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2010-2012 OpenWrt.org
SERVICE_USE_PID=1
-get_ifname() {
- local interface=$1
- local ifname
- scan_interfaces
- config_get ifname "$interface" ifname
- printf '%s\n' "$ifname"
- return 0
-}
-
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
- include /lib/network
+ . /lib/functions/network.sh
config_load "dhcp6s"
logger starting dhcp6s
- local server_interface
+ local server_interface server_ifname
config_get server_interface basic interface
- local server_ifname=$(get_ifname "$server_interface")
+ network_get_device server_ifname "$server_interface" || return 1
local config_file
config_get config_file basic config_file