[package] dnsmasq: allow multiple macs per static lease address (#6205)
[openwrt.git] / package / dnsmasq / files / dnsmasq.init
index 37b8eb8..4f8ff9d 100644 (file)
@@ -176,13 +176,18 @@ dhcp_host_add() {
        config_get networkid "$cfg" networkid
        [ -n "$networkid" ] && dhcp_option_add "$cfg" "$networkid"
 
-       config_get mac "$cfg" mac
-       [ -n "$mac" ] || return 0
+       config_get macs "$cfg" mac
+       [ -n "$macs" ] || return 0
 
        config_get ip "$cfg" ip
        [ -n "$ip" ] || return 0
 
-       append args "--dhcp-host=$mac,${networkid:+net:$networkid,}$ip${name:+,$name}"
+       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}"
 }
 
 dhcp_mac_add() {
@@ -235,7 +240,7 @@ dhcp_add() {
                DNS_SERVERS="$DNS_SERVERS $dnsserver"
        }
 
-       append_bool "$cfg" ignore "-2 $ifname" && return 0
+       append_bool "$cfg" ignore "-2 '$ifname'" && return 0
 
        config_get proto "$net" proto
        [ static = "$proto" ] || return 0
@@ -311,6 +316,7 @@ start() {
 
        /usr/sbin/dnsmasq $args && {
                rm -f /tmp/resolv.conf
+               [ -n "$DOMAIN" ] && echo "search $DOMAIN" >> /tmp/resolv.conf
                DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
                for DNS_SERVER in $DNS_SERVERS ; do
                        echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
This page took 0.028618 seconds and 4 git commands to generate.