Просмотр исходного кода

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 <[email protected]>

SVN-Revision: 42320
John Crispin 11 лет назад
Родитель
Сommit
f65ff468f7
1 измененных файлов с 8 добавлено и 6 удалено
  1. 8 6
      package/network/services/dnsmasq/files/dnsmasq.init

+ 8 - 6
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