dnsmasq: Make the --dhcp-host logic easier to understand
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 1 Sep 2014 13:22:08 +0000 (13:22 +0000)
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 1 Sep 2014 13:22:08 +0000 (13:22 +0000)
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 <cernekee@gmail.com>
Backport of r42320

git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@42390 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/network/services/dnsmasq/files/dnsmasq.init

index 06d8c840fb079a5d2864f986b96837b8ea2a3a34..942acd7ada065550ef147eb16736b78bf7e9ab36 100644 (file)
@@ -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