[source] dnsmasq: add IPv6 nameserver configuration in server mode

LEDE Commits lede-commits at lists.infradead.org
Tue May 16 13:27:16 PDT 2017


dedeckeh pushed a commit to source.git, branch master:
https://git.lede-project.org/070a46121dff0cf233e4c12f2a5bae6c9300c0eb

commit 070a46121dff0cf233e4c12f2a5bae6c9300c0eb
Author: Arjen de Korte <build+lede at de-korte.org>
AuthorDate: Fri May 12 11:26:49 2017 +0200

    dnsmasq: add IPv6 nameserver configuration in server mode
    
    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 at de-korte.org>
    Signed-off-by: Hans Dedecker <dedeckeh at gmail.com> [PKG_RELEASE increase]
---
 package/network/services/dnsmasq/Makefile           |  2 +-
 package/network/services/dnsmasq/files/dnsmasq.init | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index b94f222..784912a 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -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
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 30fec7a..5221db4 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -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"



More information about the lede-commits mailing list