[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:
parent
635485f819
commit
f07e6610b7
@ -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.
|
# 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:=dhcp
|
PKG_NAME:=dhcp
|
||||||
PKG_VERSION:=3.1.0
|
PKG_VERSION:=3.1.0
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/
|
PKG_SOURCE_URL:=ftp://ftp.isc.org/isc/dhcp/
|
||||||
|
@ -7,18 +7,6 @@ pid_file=/var/run/dhcpd.pid
|
|||||||
hosts_file=/tmp/dhcpd.hosts
|
hosts_file=/tmp/dhcpd.hosts
|
||||||
dhcp_ifs=""
|
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() {
|
parse_dhcp() {
|
||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
config_get net "$cfg" interface
|
config_get net "$cfg" interface
|
||||||
@ -27,7 +15,8 @@ parse_dhcp() {
|
|||||||
config_get_bool ignore "$1" ignore 0
|
config_get_bool ignore "$1" ignore 0
|
||||||
if [ "$ignore" -eq 1 ]; then return 0; fi
|
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() {
|
parse_host_entry() {
|
||||||
@ -56,10 +45,9 @@ parse_host_entry() {
|
|||||||
init_config() {
|
init_config() {
|
||||||
echo " #Automatically generated by dhcpd initscript, any modifications will be overwritten" > "$hosts_file"
|
echo " #Automatically generated by dhcpd initscript, any modifications will be overwritten" > "$hosts_file"
|
||||||
|
|
||||||
include /lib/network
|
. /lib/functions/network.sh
|
||||||
scan_interfaces
|
|
||||||
config_load dhcp
|
|
||||||
|
|
||||||
|
config_load dhcp
|
||||||
config_foreach parse_host_entry host
|
config_foreach parse_host_entry host
|
||||||
config_foreach parse_dhcp dhcp
|
config_foreach parse_dhcp dhcp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user