From: Jo-Philipp Wich Date: Mon, 28 May 2012 14:56:51 +0000 (+0000) Subject: radvd: use network.sh to find device names X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a2dcfa0af86a90135a728ed197b1c9d5bd9ef2e3;p=openwrt%2Fsvn-archive%2Fpackages.git radvd: use network.sh to find device names SVN-Revision: 31942 --- diff --git a/ipv6/radvd/Makefile b/ipv6/radvd/Makefile index 01b1b6d90..5a8aaf464 100644 --- a/ipv6/radvd/Makefile +++ b/ipv6/radvd/Makefile @@ -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 \ diff --git a/ipv6/radvd/files/radvd.init b/ipv6/radvd/files/radvd.init index 62e184b77..81e9001c3 100644 --- a/ipv6/radvd/files/radvd.init +++ b/ipv6/radvd/files/radvd.init @@ -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