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

git-svn-id: svn://svn.openwrt.org/openwrt/packages@31977 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-29 01:47:58 +00:00
parent 635485f819
commit f07e6610b7
2 changed files with 6 additions and 18 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:=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/

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