dnsmasq: add local hostname record for own lan ula address as well
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 12 Jan 2016 10:03:50 +0000 (10:03 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 12 Jan 2016 10:03:50 +0000 (10:03 +0000)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
SVN-Revision: 48214

package/network/services/dnsmasq/Makefile
package/network/services/dnsmasq/files/dnsmasq.init

index cddde5c0a2ef155bd8f5358ff7fa99331c51c427..d4a6f1f672a309ef1d9d8fb91997626cee9e8398 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.75
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
index 3ef2b3d64c441d2de9f3e09f418102743d956b9f..0cec6d8924e559781ab6f1277bcc763fb01c72df 100644 (file)
@@ -599,10 +599,24 @@ start_service() {
        config_foreach dhcp_hostrecord_add hostrecord
 
        # add own hostname
-       local lanaddr
-       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && network_get_ipaddr lanaddr "lan" && {
+       [ $ADD_LOCAL_HOSTNAME -eq 1 ] && {
+               local lanaddr lanaddr6
+               local ulaprefix="$(uci_get network @globals[0] ula_prefix)"
                local hostname="$(uci_get system @system[0] hostname OpenWrt)"
-               dhcp_domain_add "" "$hostname" "$lanaddr"
+
+               network_get_ipaddr lanaddr "lan" && {
+                       dhcp_domain_add "" "$hostname" "$lanaddr"
+               }
+
+               network_get_ipaddrs6 lanaddr6 "lan" && {
+                       for lanaddr6 in $lanaddr6; do
+                               case "$lanaddr6" in
+                                       "${ulaprefix%%:/*}"*)
+                                               dhcp_domain_add "" "$hostname" "${ulaprefix%%/*}1"
+                                       ;;
+                               esac
+                       done
+               }
        }
 
        echo >> $CONFIGFILE