From: blogic Date: Thu, 28 Aug 2014 06:27:57 +0000 (+0000) Subject: dnsmasq: Make the --dhcp-host logic easier to understand X-Git-Url: https://git.archive.openwrt.org/?a=commitdiff_plain;h=dab9f3b492aceb69618765fe58cba089cada1099;hp=cf974867954967bec5a41b926ed02fce688379fb;p=openwrt.git dnsmasq: Make the --dhcp-host logic easier to understand Use an if/else statement to cover the two different syntaxes. Add comments explaining what the end results should look like. This patch should not change the script's output. Signed-off-by: Kevin Cernekee git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42320 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 06d8c840fb..942acd7ada 100644 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -299,14 +299,16 @@ dhcp_host_add() { } config_get mac "$cfg" mac - [ -z "$mac" ] && { + if [ -n "$mac" ]; then + # --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap + macs="" + for m in $mac; do append macs "$m" ","; done + else + # --dhcp-host=lap,192.168.0.199 [ -n "$name" ] || return 0 - mac="$name" + macs="$name" name="" - } - - macs="" - for m in $mac; do append macs "$m" ","; done + fi config_get tag "$cfg" tag