From 185b9f4f192cb9d32f6a6e396c2048a032db951f Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 24 May 2026 12:55:53 +0900 Subject: [PATCH] service: dnsmasq: Add ipv4? and ipv6? configuration options. * gnu/services/dns.scm () [ipv4?, ipv6?]: New fields. (dnsmasq-shepherd-service): Use them. * doc/guix.texi (DNS Services): Document them. Change-Id: I50a4e407cea9e55295c9cfff081b7678ab7e061c --- doc/guix.texi | 6 ++++++ gnu/services/dns.scm | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0cb9b513caf..7a8ec55b956 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -38201,6 +38201,12 @@ ie a subnet for which an interface exists on the server. @item @code{listen-addresses} (default: @code{'()}) Listen on the given IP addresses. +@item @code{ipv4?} (default: @code{#t}) +Whether to include A records in answers. + +@item @code{ipv6?} (default: @code{#t}) +Whether to include AAAA records in answers. + @item @code{resolv-file} (default: @code{"/etc/resolv.conf"}) The file to read the IP address of the upstream nameservers from. diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index e0cab485884..d4f771b9b68 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -64,6 +64,8 @@ dnsmasq-configuration-port dnsmasq-configuration-local-service? dnsmasq-configuration-listen-address + dnsmasq-configuration-ipv4? + dnsmasq-configuration-ipv6? dnsmasq-configuration-resolv-file dnsmasq-configuration-no-resolv? dnsmasq-configuration-forward-private-reverse-lookup? @@ -793,6 +795,10 @@ cache.size = 100 * MB (default #t)) ;boolean (listen-addresses dnsmasq-configuration-listen-address (default '())) ;list of string + (ipv4? dnsmasq-configuration-ipv4? + (default #t)) + (ipv6? dnsmasq-configuration-ipv6? + (default #t)) (resolv-file dnsmasq-configuration-resolv-file (default "/etc/resolv.conf")) ;string (no-resolv? dnsmasq-configuration-no-resolv? @@ -859,7 +865,7 @@ cache.size = 100 * MB shepherd-requirement pid-file no-hosts? - port local-service? listen-addresses + port local-service? listen-addresses ipv4? ipv6? resolv-file no-resolv? forward-private-reverse-lookup? query-servers-in-order? servers addresses servers-file @@ -891,6 +897,12 @@ cache.size = 100 * MB '()) #$@(map (cut format #f "--listen-address=~a" <>) listen-addresses) + #$@(if (not ipv4?) + '("--filter-A") + '()) + #$@(if (not ipv6?) + '("--filter-AAAA") + '()) #$(format #f "--resolv-file=~a" resolv-file) #$@(if no-resolv? '("--no-resolv")