dnsmasq: add IPv6 nameserver configuration in server mode
authorArjen de Korte <build+lede@de-korte.org>
Fri, 12 May 2017 09:26:49 +0000 (11:26 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Tue, 16 May 2017 20:27:02 +0000 (22:27 +0200)
When in ra server mode, configure nameservers passed in router
announcements from the dns value (which is already used by odhcpd).

This also fixes FS#677 by using the global IPv6 address of the router
instead of the link local address (if no nameservers are configured).

Signed-off-by: Arjen de Korte <build+lede@de-korte.org>
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
package/network/services/dnsmasq/Makefile
package/network/services/dnsmasq/files/dnsmasq.init

index b94f222fa5b66804b4d010bbf5146b12a246b720..784912a9e0adce16156776cbbc18d2086a3b4a49 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.77rc3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/release-candidates
index 30fec7a4ee9bbf93ab10e36d74e6849b878ceffe..5221db46f627cfebe044bba2989188c070ed44fb 100644 (file)
@@ -470,6 +470,7 @@ dhcp_add() {
        config_get ra "$cfg" ra
        config_get ra_management "$cfg" ra_management
        config_get ra_preference "$cfg" ra_preference
+       config_get dns "$cfg" dns
 
        config_list_foreach "$cfg" "interface_name" append_interface_name "$ifname"
 
@@ -539,6 +540,15 @@ dhcp_add() {
                        xappend "--dhcp-range=$nettag$dhcp6range,constructor:$ifname,slaac,ra-names,$leasetime"
                        ;;
                esac
+
+               if [ -n "$dns" ]; then
+                       dnss=""
+                       for d in $dns; do append dnss "[$d]" ","; done
+               else
+                       dnss="[::]"
+               fi
+
+               dhcp_option_append "option6:dns-server,$dnss" "$networkid"
        fi
 
        dhcp_option_add "$cfg" "$networkid"