[packages] dhcp: use network.sh to find device names
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:47:58 +0000 (01:47 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 29 May 2012 01:47:58 +0000 (01:47 +0000)
SVN-Revision: 31977

net/dhcp/Makefile
net/dhcp/files/dhcpd.init

index df90fdf2ae958f278a4b1dbe7c79bb0a51cb7be5..e52405483397264346f5221dde460fa9177a3be8 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:=dhcp
 PKG_VERSION:=3.1.0
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/
index 308f3aa40ddce1fb2166f6a84a4d57a5fe1c76f5..003c370f4eefbf597db69b7909be35da9a2f90d0 100644 (file)
@@ -7,18 +7,6 @@ pid_file=/var/run/dhcpd.pid
 hosts_file=/tmp/dhcpd.hosts
 dhcp_ifs=""
 
-append_interface() {
-       local ifname=$(uci_get_state network "$1" device)
-       if [ "$(uci_get_state network "$1" type)" = "bridge" ]; then
-               ifname=$(uci_get_state network "$1" ifname); fi
-
-       if [ -z "$dhcp_ifs" ]; then
-               dhcp_ifs="$ifname"
-       else
-               dhcp_ifs="$dhcp_ifs $ifname"
-       fi
-}
-
 parse_dhcp() {
        local cfg="$1"
        config_get net "$cfg" interface
@@ -27,7 +15,8 @@ parse_dhcp() {
        config_get_bool ignore "$1" ignore 0
        if [ "$ignore" -eq 1 ]; then return 0; fi
 
-       append_interface $net
+       local dev
+       network_get_device dev "$net" && append dhcp_ifs "$dev"
 }
 
 parse_host_entry() {
@@ -56,10 +45,9 @@ parse_host_entry() {
 init_config() {
        echo " #Automatically generated by dhcpd initscript, any modifications will be overwritten" > "$hosts_file"
 
-       include /lib/network
-       scan_interfaces
-       config_load dhcp
+       . /lib/functions/network.sh
 
+       config_load dhcp
        config_foreach parse_host_entry host
        config_foreach parse_dhcp dhcp
 }