X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/ddaa3d81f23f9aa4a7a5da5763d63fe407fb04a2..a34ec011e8ce972bd6df4b0808a5029da81d40a4:/package/dnsmasq/files/dnsmasq.init diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init index 4cd941cfd..15f856d4e 100644 --- a/package/dnsmasq/files/dnsmasq.init +++ b/package/dnsmasq/files/dnsmasq.init @@ -296,9 +296,17 @@ dhcp_domain_add() { local raddr="${4:+$4.$3.$2.$1.in-addr.arpa}" for name in $names; do - append args "-A /$name${DOMAIN:+.$DOMAIN}/$ip" - [ -n "$raddr" ] && \ - append args "--ptr-record=$raddr,$name${DOMAIN:+.$DOMAIN}" + local fqdn="$name" + + [ "${fqdn%.*}" == "$fqdn" ] && \ + fqdn="$fqdn${DOMAIN:+.$DOMAIN}" + + append args "-A /$fqdn/$ip" + + [ -n "$raddr" ] && { + append args "--ptr-record=$raddr,$fqdn" + raddr="" + } done }