[packages] rarpd: use network.sh to find devices
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:11:32 +0000 (01:11 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:11:32 +0000 (01:11 +0000)
SVN-Revision: 31968

net/rarpd/Makefile
net/rarpd/files/rarpd.init

index 0d6acd2e8530e82ead32c9725028dbb496f8449a..25a98a84165df835b3df50c303cac9b1ccbac6c2 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:=rarpd
 PKG_VERSION:=1.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=ftp://ftp.dementia.org/pub/net-tools
index 8c6522c6d38669352234d4b788a751d108fb99bf..68feb32a12a6c55dd48fd2fbac788bd20d3c4374 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/sh /etc/rc.common
-# Copyright (C) 2006-2011 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 
 START=50
 
@@ -26,16 +26,6 @@ append_string() {
        [ -n "$_val" ] && append "$var" "$val $_val"
 }
 
-config_get_ifname() {
-       local var="$1"
-       local section="$2"
-       local option="$3"
-       local val="$4"
-       local _val
-       config_get _val "$section" "$option" "$val"
-       [ -n "$_val" ] && config_get "$var" "$_val" 'ifname' "$_val"
-}
-
 section_enabled() {
        local enabled
        config_get_bool enabled "$1" 'enabled' 0
@@ -45,42 +35,45 @@ section_enabled() {
 start_instance() {
        local section="$1"
        local if
+       local dev
        local args
 
        section_enabled "$section" || return 1
 
-       config_get_ifname if "$section" 'interface' 'lan'
-       args="-n -i $if"
-       append_string args "$section" 'ethers' '-e'
-       append_bool args "$section" 'verbose' '-v'
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if" && {
+               args="-n -i $if"
+               append_string args "$section" 'ethers' '-e'
+               append_bool args "$section" 'verbose' '-v'
 
-       SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
-       service_start /usr/sbin/rarpd $args
+               SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
+               service_start /usr/sbin/rarpd $args
+       }
 }
 
 stop_instance() {
        local section="$1"
        local id
        local if
+       local dev
 
        section_enabled "$section" || return 1
 
-       config_get_ifname if "$section" 'interface' 'lan'
+       config_get if "$section" 'interface' 'lan'
+       network_get_device dev "$if"
 
        SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
        service_stop /usr/sbin/rarpd
 }
 
 start() {
-       include /lib/network
-       scan_interfaces
+       . /lib/functions/network.sh
        config_load 'rarpd'
        config_foreach start_instance 'rarpd'
 }
 
 stop() {
-       include /lib/network
-       scan_interfaces
+       . /lib/functions/network.sh
        config_load 'rarpd'
        config_foreach stop_instance 'rarpd'
 }