Updated version of the patch without hardcoded interface. lanaddr isn't
used anymore so drop it.

Use the --interface-name option of dnsmasq 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)
@@ -473,8 +473,8 @@
        include /lib/network
        scan_interfaces

-       local lanaddr
-       config_get lanaddr "lan" ipaddr
+       local lanifname
+       config_get lanifname "lan" ifname

        config_load dhcp

@@ -511,9 +511,12 @@
        echo >> $CONFIGFILE

        # add own hostname
-       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && [ -n "$lanaddr" ] && {
+       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && [ -n "$lanifname" ] && {
                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, $lanifname"
        }

        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