[packages] radvd: use network.sh to find device names

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31942 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-28 14:56:51 +00:00
parent 666a23e096
commit 02a568e6af
2 changed files with 9 additions and 30 deletions

View 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 \

View 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