dnsmasq: allow hostname assignment without static lease The attached patch for dnsmas...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 24 May 2011 09:12:50 +0000 (09:12 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 24 May 2011 09:12:50 +0000 (09:12 +0000)
It corresponds to the following example in dnsmasq.conf.example:

# Always set the name of the host with hardware address
# 11:22:33:44:55:66 to be "fred"
#dhcp-host=11:22:33:44:55:66,fred

Regards
Mathias

SVN-Revision: 26983

package/dnsmasq/Makefile
package/dnsmasq/files/dnsmasq.init

index b71db58587a68f098fbea17ebc4bce192f44289f..accce6e40e10ae3b384ab78ae1e1b346c716be85 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.57
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
index cd5a78ae835a9658b3098d526e71158d246e3891..a0e893c5fd038ca3014a9c3215ac3f64b297290c 100644 (file)
@@ -206,20 +206,19 @@ dhcp_vendorclass_add() {
 dhcp_host_add() {
        local cfg="$1"
 
-       config_get name "$cfg" name
-
        config_get networkid "$cfg" networkid
        [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid"
 
+       config_get name "$cfg" name
        config_get ip "$cfg" ip
-       [ -n "$ip" ] || return 0
+       [ -n "$ip" ] || [ -n "$name" ] || return 0
 
        macs=""
        config_get mac "$cfg" mac
        for m in $mac; do append macs "$m" ","; done
        [ -n "$macs" ] || return 0
 
-       append args "--dhcp-host=$macs,${networkid:+net:$networkid,}$ip${name:+,$name}"
+       append args "--dhcp-host=$macs${networkid:+,net:$networkid}${ip:+,$ip}${name:+,$name}"
 }
 
 dhcp_mac_add() {