diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-05-24 09:12:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-05-24 09:12:50 +0000 |
commit | 50b69073d6b2fffe259f4c0b78fb35ab60f761c3 (patch) | |
tree | 9184546f0c19e86af262075a99d7f07a1fe5e74e /package/dnsmasq/files/dnsmasq.init | |
parent | be906f6be55b890edc766a8826c8cc56f0732d8d (diff) | |
download | mtk-20170518-50b69073d6b2fffe259f4c0b78fb35ab60f761c3.zip mtk-20170518-50b69073d6b2fffe259f4c0b78fb35ab60f761c3.tar.gz mtk-20170518-50b69073d6b2fffe259f4c0b78fb35ab60f761c3.tar.bz2 |
dnsmasq: allow hostname assignment without static lease The attached patch for dnsmasq.init allows to assign a hostname to a particular mac-address. It's useful to override the client supplied hostname, especially if the client does not supply a hostname at all.
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
Diffstat (limited to 'package/dnsmasq/files/dnsmasq.init')
-rw-r--r-- | package/dnsmasq/files/dnsmasq.init | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index cd5a78a..a0e893c 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -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() { |