From 21c71cc7e42e6651047f67387343a510b0bf5bfe Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 29 May 2012 01:47:58 +0000 Subject: [PATCH] [packages] dhcp: use network.sh to find device names SVN-Revision: 31977 --- net/dhcp/Makefile | 4 ++-- net/dhcp/files/dhcpd.init | 20 ++++---------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/net/dhcp/Makefile b/net/dhcp/Makefile index df90fdf2ae..e524054833 100644 --- a/net/dhcp/Makefile +++ b/net/dhcp/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:=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/ diff --git a/net/dhcp/files/dhcpd.init b/net/dhcp/files/dhcpd.init index 308f3aa40d..003c370f4e 100644 --- a/net/dhcp/files/dhcpd.init +++ b/net/dhcp/files/dhcpd.init @@ -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 } -- 2.30.2