With this patch, the --interface-name option of dnsmasq is used to add
a DNS record for the openwrt box. Starting with dnsmasq 2.67test5 it
does even work for ipv6 addresses. IPv6 addresses with an expired
lifetime will be automatically replaced with a new valid one.

Signed-off-by: Mathias Kresin <open...@kresin.me>
---
Index: package/network/services/dnsmasq/files/dnsmasq.init
===================================================================
--- package/network/services/dnsmasq/files/dnsmasq.init (revision 36743)
+++ package/network/services/dnsmasq/files/dnsmasq.init (working copy)
@@ -511,9 +511,12 @@
        echo >> $CONFIGFILE

        # add own hostname
-       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && [ -n "$lanaddr" ] && {
+       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && {
                local hostname="$(uci_get system.@system[0].hostname)"
-               dhcp_domain_add "" "${hostname:-OpenWrt}" "$lanaddr"
+               [ "${hostname%.*}" == "$hostname" ] && {
+                       hostname="${hostname:-OpenWrt}.${DOMAIN:-lan}"
+               }
+               xappend "--interface-name=$hostname, br-lan"
        }

        service_start /usr/sbin/dnsmasq -C $CONFIGFILE && {
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to