[packages] olsrd: use network.sh to find devices

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31966 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-29 00:59:38 +00:00
parent db4d0eb42e
commit 38ed8b5cd7
2 changed files with 7 additions and 26 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2009-2011 OpenWrt.org # Copyright (C) 2009-2012 OpenWrt.org
# #
# This is free software, licensed under the GNU General Public License v2. # This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information. # See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=olsrd PKG_NAME:=olsrd
PKG_VERSION:=0.6.2 PKG_VERSION:=0.6.2
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6 PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6

View File

@ -1,5 +1,5 @@
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
# Copyright (C) 2008-2011 OpenWrt.org # Copyright (C) 2008-2012 OpenWrt.org
START=65 START=65
@ -26,30 +26,12 @@ validate_varname() {
return 0 return 0
} }
validate_ifname() {
local ifname="$1"
[ -z "$ifname" -o "$ifname" != "${ifname%%[!A-Za-z0-9.:_-]*}" ] && return 1
return 0
}
validate_olsrd_option() { validate_olsrd_option() {
local str="$1" local str="$1"
[ -z "$str" -o "$str" != "${str%%[! 0-9A-Za-z./|:_-]*}" ] && return 1 [ -z "$str" -o "$str" != "${str%%[! 0-9A-Za-z./|:_-]*}" ] && return 1
return 0 return 0
} }
get_ifname() {
IFNAME=
local interface="$1"
validate_varname "$interface" || return 1
local ifname
config_get ifname "$interface" ifname
validate_ifname "$ifname" || return 1
IFNAME="$ifname"
return 0
}
system_config() { system_config() {
local cfg="$1" local cfg="$1"
local cfgt local cfgt
@ -180,8 +162,7 @@ olsrd_write_plparam() {
fi fi
if [ "$option" = 'NonOlsrIf' ]; then if [ "$option" = 'NonOlsrIf' ]; then
if validate_varname "$value"; then if validate_varname "$value"; then
if get_ifname "$value"; then if network_get_device ifname "$value"; then
ifname="$IFNAME"
echo "Info: mdns Interface '$value' ifname '$ifname' found" 1>&2 echo "Info: mdns Interface '$value' ifname '$ifname' found" 1>&2
else else
echo "Warning: mdns Interface '$value' not found, skipped" 1>&2 echo "Warning: mdns Interface '$value' not found, skipped" 1>&2
@ -495,7 +476,7 @@ olsrd_write_interface() {
config_get interfaces "$cfg" interface config_get interfaces "$cfg" interface
for interface in $interfaces; do for interface in $interfaces; do
if validate_varname "$interface"; then if validate_varname "$interface"; then
if get_ifname "$interface"; then if network_get_device IFNAME "$interface"; then
ifnames="$ifnames \"$IFNAME\"" ifnames="$ifnames \"$IFNAME\""
ifsglobal="$ifsglobal $IFNAME" ifsglobal="$ifsglobal $IFNAME"
else else
@ -659,8 +640,8 @@ start() {
olsrd_update_schema "list" "$@" olsrd_update_schema "list" "$@"
} }
include /lib/network . /lib/functions/network.sh
scan_interfaces
config_load olsrd config_load olsrd
reset_cb reset_cb