[packages] radvd: use network.sh to find device names
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 28 May 2012 14:56:51 +0000 (14:56 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 28 May 2012 14:56:51 +0000 (14:56 +0000)
SVN-Revision: 31942

ipv6/radvd/Makefile
ipv6/radvd/files/radvd.init

index 01b1b6d9005cbc6d0b51d32249868940ab750bae..5a8aaf464af67eea07c9abbbb2f872868f5a119e 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=radvd
 PKG_VERSION:=1.8.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://v6web.litech.org/radvd/dist \
index 62e184b77b856eab96ce48ccab6000cf8774343d..81e9001c33077213051f6a77b9c00e982ea99f09 100644 (file)
@@ -25,12 +25,6 @@ validate_varname() {
        return 0
 }
 
-validate_ifname() {
-       local ifname=$1
-       [ -z "$ifname" -o "$ifname" != "${ifname%%[!A-Za-z0-9.:_-]*}" ] && return 1
-       return 0
-}
-
 validate_ip6addr() {
        local ip6addr=$1
        [ -z "$ip6addr" -o "$ip6addr" != "${ip6addr%%[!A-Fa-f0-9.:]*}" ] && return 1
@@ -49,22 +43,6 @@ validate_radvd_string() {
        return 0
 }
 
-get_ifname() {
-       local interface=$1
-       validate_varname "$interface" || return 1
-       local cfgt
-       local ifname
-
-       scan_interfaces
-       config_get cfgt "$interface" TYPE
-       [ "$cfgt" != "interface" ] && return 1
-       config_get ifname "$interface" ifname
-       validate_ifname "$ifname" || return 1
-       printf '%s\n' "$ifname"
-
-       return 0
-}
-
 get_ip6addr() {
        local ifname=$1
        local scope=$2
@@ -185,6 +163,7 @@ radvd_write_prefix() {
        local ignore
        local interfaces
        local interface
+       local device
        local prefixes
        local prefix
        local name
@@ -229,15 +208,15 @@ radvd_write_prefix() {
 
                config_get value "$cfg" Base6Interface
                if [ -n "$value" ]; then
-                       if ifname=$(get_ifname "$value"); then
-                               printf '\t\t%s %s;\n' "Base6Interface" "$ifname"
+                       if network_get_device device "$value"; then
+                               printf '\t\t%s %s;\n' "Base6Interface" "$device"
                        fi
                fi
 
                config_get value "$cfg" Base6to4Interface
                if [ -n "$value" ]; then
-                       if ifname=$(get_ifname "$value"); then
-                               printf '\t\t%s %s;\n' "Base6to4Interface" "$ifname"
+                       if network_get_device device "$value"; then
+                               printf '\t\t%s %s;\n' "Base6to4Interface" "$device"
                        fi
                fi
 
@@ -388,7 +367,7 @@ radvd_write_dnssl() {
 }
 
 radvd_write_config() {
-       include /lib/network
+       . /lib/functions/network.sh
 
        RADVD_INTERFACES=
        config_foreach radvd_add_interface interface
@@ -398,7 +377,7 @@ radvd_write_config() {
        config_foreach radvd_add_interface DNSSL
 
        for INTERFACE in $RADVD_INTERFACES; do
-               IFNAME=$(get_ifname "$INTERFACE") || continue
+               network_get_device IFNAME "$INTERFACE" || continue
                printf 'interface %s\n{\n' "$IFNAME"
                config_foreach radvd_write_interface interface
                config_foreach radvd_write_prefix prefix