all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#61869] gnu: services: Add more dnsmasq options.
@ 2023-02-28 13:36 Wicki Gabriel (wicg)
  2023-03-08 14:56 ` [bug#61869] Updated patch Wicki Gabriel (wicg)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wicki Gabriel (wicg) @ 2023-02-28 13:36 UTC (permalink / raw)
  To: 61869


[-- Attachment #1.1: Type: text/plain, Size: 125 bytes --]

Hi y'all

I've created a patch which adds more options to the dnsmasq service.  Thanks in advance for merging,

g




[-- Attachment #1.2: Type: text/html, Size: 1761 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-services-Add-more-dnsmasq-options.patch --]
[-- Type: text/x-patch; name="0001-gnu-services-Add-more-dnsmasq-options.patch", Size: 6735 bytes --]

From bb85650b9bac7afb4a21d483d2bb6249857a02c0 Mon Sep 17 00:00:00 2001
From: gabriel <gabriel@erlikon.ch>
Date: Thu, 23 Feb 2023 16:46:29 +0100
Subject: [PATCH] gnu: services: Add more dnsmasq options.

* gnu/services/dns.scm (dnsmasq-configuration, dnsmasq-shepherd-service): Add
options domain-needed?, bogus-priv?, filterwin2k?, poll?, local, interface,
bind-dynamic?, expand-hosts?, domain, dhcp-range and dhcp-option, as they are
documented in dnsmasq's manual.
* doc/guix.texi (dnsmasq-configuration): Document them.
---
 doc/guix.texi        | 38 +++++++++++++++++++++++++++
 gnu/services/dns.scm | 62 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 98 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 05615b9549..bab2f5491e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31317,6 +31317,44 @@ When false, disable negative caching.
 If set, add a CPE (Customer-Premises Equipment) identifier to DNS
 queries which are forwarded upstream.
 
+@item @code{domain-needed?} (default: @code{#f})
+Whether to forward queries with no domain part.
+
+@item @code{bogus-priv?} (default: @code{#f})
+Whether to fake reverse lookups for RFC1918 private address ranges.
+
+@item @code{filterwin2k?} (default: @code{#f})
+Whether to forward spurious DNS requests from Windows hosts.
+
+@item @code{poll?} (default: @code{#f})
+Continuously reads @file{/etc/resolv.conf} when @code{#true}, otherwise only
+does so on SIGHUP.
+
+@item @code{local} (default: @code{#f})
+A string representing domains where nothing will be forwarded to
+@code{"/domain/"}).
+
+@item @code{interface} (default: @code{#f})
+The interface(s) dnsmasq works on (like @code{"wlp3"} or @code{"lan0"}.
+Multiple names can be specified as strings separated by commas.
+
+@item @code{bind-dynamic?} (default: @code{#f})
+Bind to interfaces in use - check for new interfaces.
+
+@item @code{expand-hosts?} (default: @code{#f})
+Expand simple names in @file{/etc/hosts} with domain-suffix.
+
+@item @code{domain} (default: @code{#f})
+Specify the domain to be assigned in DHCP leases.
+
+@item @code{dhcp-range} (default: @code{#f})
+Enable DHCP in the range given with lease duration, the format is
+@code{<START-IP>,<END-IP>,<MASK>,<LEASE-TIME>}, e.g.
+@code{10.42.0.50,10.42.0.150,255.255.255.0,1h}.
+
+@item @code{dhcp-options} (default: @code{'()})
+A list of options to be passed along.
+
 @item @code{tftp-enable?} (default: @code{#f})
 Whether to enable the built-in TFTP server.
 
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 50753b7ab6..48fee15192 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -749,8 +749,7 @@ (define-record-type* <dnsmasq-configuration>
   (forward-private-reverse-lookup?
                     dnsmasq-configuration-forward-private-reverse-lookup?
                     (default #t))       ;boolean
-  (query-servers-in-order?
-                    dnsmasq-configuration-query-servers-in-order?
+  (query-servers-in-order? dnsmasq-configuration-query-servers-in-order?
                     (default #f))       ;boolean
   (servers          dnsmasq-configuration-servers
                     (default '()))      ;list of string
@@ -762,6 +761,28 @@ (define-record-type* <dnsmasq-configuration>
                     (default #t))       ;boolean
   (cpe-id           dnsmasq-configuration-cpe-id
                     (default #t))       ;string
+  (domain-needed?   dnsmasq-configuration-domain-needed?
+                    (default #f))       ;boolean
+  (bogus-priv?      dnsmasq-configuration-bogus-priv?
+                    (default #f))       ;boolean
+  (filterwin2k?     dnsmasq-configuration-filterwin2k?
+                    (default #f))       ;boolean
+  (poll?            dnsmasq-configuration-poll?
+                    (default #t))       ;boolean
+  (local            dnsmasq-configuration-local
+                    (default #f))       ;string
+  (interface        dnsmasq-configuration-interface
+                    (default #f))       ;string
+  (bind-dynamic?    dnsmasq-configuration-bind-dynamic?
+                    (default #f))       ;boolean
+  (expand-hosts?    dnsmasq-configuration-expand-hosts?
+                    (default #f))       ;boolean
+  (domain           dnsmasq-configuration-domain
+                    (default #f))       ;string
+  (dhcp-range       dnsmasq-configuration-dhcp-range
+                    (default #f))       ;string
+  (dhcp-options      dnsmasq-configuration-dhcp-options
+                    (default '()))      ;list of string
   (tftp-enable?     dnsmasq-configuration-tftp-enable?
                     (default #f))       ;boolean
   (tftp-no-fail?    dnsmasq-configuration-tftp-no-fail?
@@ -795,6 +816,11 @@ (define (dnsmasq-shepherd-service config)
      servers addresses
      cache-size negative-cache?
      cpe-id
+     domain-needed? bogus-priv? filterwin2k? poll?
+     local interface
+     bind-dynamic? expand-hosts?
+     domain
+     dhcp-range dhcp-options
      tftp-enable? tftp-no-fail?
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
@@ -838,6 +864,38 @@ (define (dnsmasq-shepherd-service config)
                  #$@(if cpe-id
                         (list (format #f "--add-cpe-id=~a" cpe-id))
                         '())
+                 #$@(if domain-needed?
+                        '("--domain-needed")
+                        '())
+                 #$@(if bogus-priv?
+                        '("--bogus-priv")
+                        '())
+                 #$@(if filterwin2k?
+                        '("--filterwin2k")
+                        '())
+                 #$@(if poll?
+                        '()
+                        '("--no-poll"))
+                 #$@(if local
+                        (list (format #f "--local=~a" local))
+                        '())
+                 #$@(if interface
+                        (list (format #f "--interface=~a" interface))
+                        '())
+                 #$@(if bind-dynamic?
+                        '("--bind-dynamic")
+                        '())
+                 #$@(if expand-hosts?
+                        '("--expand-hosts")
+                        '())
+                 #$@(if domain
+                        (list (format #f "--domain=~a" domain))
+                        '())
+                 #$@(if dhcp-range
+                        (list (format #f "--dhcp-range=~a" dhcp-range))
+                        '())
+                 #$@(map (cut format #f "--dhcp-option=~a" <>)
+                      dhcp-options)
                  #$@(if tftp-enable?
                         '("--enable-tftp")
                         '())
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#61869] Updated patch
  2023-02-28 13:36 [bug#61869] gnu: services: Add more dnsmasq options Wicki Gabriel (wicg)
@ 2023-03-08 14:56 ` Wicki Gabriel (wicg)
  2023-08-15 15:20 ` [bug#61869] gnu: services: Add more dnsmasq options Tobias Geerinckx-Rice via Guix-patches via
  2023-08-21 15:12 ` [bug#61869] Review of the third patch Wicki Gabriel (wicg)
  2 siblings, 0 replies; 4+ messages in thread
From: Wicki Gabriel (wicg) @ 2023-03-08 14:56 UTC (permalink / raw)
  To: 61869@debbugs.gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 214 bytes --]

Hi

There were two small changes i wanted to address before merging:
 - the standard /24 block for documenting is 192.0.2.0/24
 - i had the default option for --no-poll (poll?) wrong in the documentation.



[-- Attachment #1.2: Type: text/html, Size: 1671 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-services-Add-more-dnsmasq-options.patch --]
[-- Type: text/x-patch; name="0001-gnu-services-Add-more-dnsmasq-options.patch", Size: 7444 bytes --]

From ac94edd8992987270ab0ecf1019dd2452d4b0e8b Mon Sep 17 00:00:00 2001
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Thu, 23 Feb 2023 16:46:29 +0100
Subject: [PATCH] gnu: services: Add more dnsmasq options.

* gnu/services/dns.scm (dnsmasq-configuration, dnsmasq-shepherd-service): Add
options domain-needed?, bogus-priv?, filterwin2k?, poll?, local, interface,
bind-dynamic?, expand-hosts?, domain, dhcp-range and dhcp-option, as they are
documented in dnsmasq's manual.
* doc/guix.texi (dnsmasq-configuration): Document them.
---
 doc/guix.texi        | 39 +++++++++++++++++++++++++++
 gnu/services/dns.scm | 63 ++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 05615b9549..d7f63e711b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -114,6 +114,7 @@ Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@*
 Copyright @copyright{} 2023 Giacomo Leidi@*
 Copyright @copyright{} 2022 Antero Mejr@*
 Copyright @copyright{} 2023 Bruno Victal@*
+Copyright @copyright{} 2023 Gabriel Wicki@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -31317,6 +31318,44 @@ When false, disable negative caching.
 If set, add a CPE (Customer-Premises Equipment) identifier to DNS
 queries which are forwarded upstream.
 
+@item @code{domain-needed?} (default: @code{#f})
+Whether to forward queries with no domain part.
+
+@item @code{bogus-priv?} (default: @code{#f})
+Whether to fake reverse lookups for RFC1918 private address ranges.
+
+@item @code{filterwin2k?} (default: @code{#f})
+Whether to forward spurious DNS requests from Windows hosts.
+
+@item @code{poll?} (default: @code{#t})
+Continuously reads @file{/etc/resolv.conf} when @code{#true}, otherwise only
+does so on SIGHUP.
+
+@item @code{local} (default: @code{#f})
+A string representing domains where nothing will be forwarded to
+@code{"/domain/"}).
+
+@item @code{interface} (default: @code{#f})
+The interface(s) dnsmasq works on (like @code{"wlp3"} or @code{"lan0"}.
+Multiple names can be specified as strings separated by commas.
+
+@item @code{bind-dynamic?} (default: @code{#f})
+Bind to interfaces in use - check for new interfaces.
+
+@item @code{expand-hosts?} (default: @code{#f})
+Expand simple names in @file{/etc/hosts} with domain-suffix.
+
+@item @code{domain} (default: @code{#f})
+Specify the domain to be assigned in DHCP leases.
+
+@item @code{dhcp-range} (default: @code{#f})
+Enable DHCP in the range given with lease duration, the format is
+@code{<START-IP>,<END-IP>,<MASK>,<LEASE-TIME>}, e.g.
+@code{192.0.2.50,192.0.2.150,255.255.255.0,1h}.
+
+@item @code{dhcp-options} (default: @code{'()})
+A list of options to be passed along.
+
 @item @code{tftp-enable?} (default: @code{#f})
 Whether to enable the built-in TFTP server.
 
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 50753b7ab6..d4b9a78c7a 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
+;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -749,8 +750,7 @@ (define-record-type* <dnsmasq-configuration>
   (forward-private-reverse-lookup?
                     dnsmasq-configuration-forward-private-reverse-lookup?
                     (default #t))       ;boolean
-  (query-servers-in-order?
-                    dnsmasq-configuration-query-servers-in-order?
+  (query-servers-in-order? dnsmasq-configuration-query-servers-in-order?
                     (default #f))       ;boolean
   (servers          dnsmasq-configuration-servers
                     (default '()))      ;list of string
@@ -762,6 +762,28 @@ (define-record-type* <dnsmasq-configuration>
                     (default #t))       ;boolean
   (cpe-id           dnsmasq-configuration-cpe-id
                     (default #t))       ;string
+  (domain-needed?   dnsmasq-configuration-domain-needed?
+                    (default #f))       ;boolean
+  (bogus-priv?      dnsmasq-configuration-bogus-priv?
+                    (default #f))       ;boolean
+  (filterwin2k?     dnsmasq-configuration-filterwin2k?
+                    (default #f))       ;boolean
+  (poll?            dnsmasq-configuration-poll?
+                    (default #t))       ;boolean
+  (local            dnsmasq-configuration-local
+                    (default #f))       ;string
+  (interface        dnsmasq-configuration-interface
+                    (default #f))       ;string
+  (bind-dynamic?    dnsmasq-configuration-bind-dynamic?
+                    (default #f))       ;boolean
+  (expand-hosts?    dnsmasq-configuration-expand-hosts?
+                    (default #f))       ;boolean
+  (domain           dnsmasq-configuration-domain
+                    (default #f))       ;string
+  (dhcp-range       dnsmasq-configuration-dhcp-range
+                    (default #f))       ;string
+  (dhcp-options      dnsmasq-configuration-dhcp-options
+                    (default '()))      ;list of string
   (tftp-enable?     dnsmasq-configuration-tftp-enable?
                     (default #f))       ;boolean
   (tftp-no-fail?    dnsmasq-configuration-tftp-no-fail?
@@ -795,6 +817,11 @@ (define (dnsmasq-shepherd-service config)
      servers addresses
      cache-size negative-cache?
      cpe-id
+     domain-needed? bogus-priv? filterwin2k? poll?
+     local interface
+     bind-dynamic? expand-hosts?
+     domain
+     dhcp-range dhcp-options
      tftp-enable? tftp-no-fail?
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
@@ -838,6 +865,38 @@ (define (dnsmasq-shepherd-service config)
                  #$@(if cpe-id
                         (list (format #f "--add-cpe-id=~a" cpe-id))
                         '())
+                 #$@(if domain-needed?
+                        '("--domain-needed")
+                        '())
+                 #$@(if bogus-priv?
+                        '("--bogus-priv")
+                        '())
+                 #$@(if filterwin2k?
+                        '("--filterwin2k")
+                        '())
+                 #$@(if poll?
+                        '()
+                        '("--no-poll"))
+                 #$@(if local
+                        (list (format #f "--local=~a" local))
+                        '())
+                 #$@(if interface
+                        (list (format #f "--interface=~a" interface))
+                        '())
+                 #$@(if bind-dynamic?
+                        '("--bind-dynamic")
+                        '())
+                 #$@(if expand-hosts?
+                        '("--expand-hosts")
+                        '())
+                 #$@(if domain
+                        (list (format #f "--domain=~a" domain))
+                        '())
+                 #$@(if dhcp-range
+                        (list (format #f "--dhcp-range=~a" dhcp-range))
+                        '())
+                 #$@(map (cut format #f "--dhcp-option=~a" <>)
+                      dhcp-options)
                  #$@(if tftp-enable?
                         '("--enable-tftp")
                         '())
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#61869] gnu: services: Add more dnsmasq options.
  2023-02-28 13:36 [bug#61869] gnu: services: Add more dnsmasq options Wicki Gabriel (wicg)
  2023-03-08 14:56 ` [bug#61869] Updated patch Wicki Gabriel (wicg)
@ 2023-08-15 15:20 ` Tobias Geerinckx-Rice via Guix-patches via
  2023-08-21 15:12 ` [bug#61869] Review of the third patch Wicki Gabriel (wicg)
  2 siblings, 0 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2023-08-15 15:20 UTC (permalink / raw)
  To: 61869

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hi Gabriel,

I've rebased this patch onto current master (attached).  I've also made 
some changes in a third patch that I'd like *you* to review, and ideally 
test.

Some remarks:
- For the commit message, I prefer ‘services: foo:’ to ‘gnu: services:’.
- Use the previous Texinfo @node{} title in the commit message.
- I added bind-interfaces? only because it occurs in my documentation 
for another new option.
- I don't use the dnsmasq service so I'm not 100% confident about some 
of my changes.  Please let me know if, for example, something doesn't 
make sense as a list.

Thanks!

T G-R

Sent from a Web browser.  Excuse or enjoy my brevity.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-services-dnsmasq-Add-more-service-options.patch --]
[-- Type: text/x-diff; name=0001-services-dnsmasq-Add-more-service-options.patch, Size: 6977 bytes --]

From a55db64e79c95d483cdcf97c38ec6ab4a49170ba Mon Sep 17 00:00:00 2001
Message-ID: <a55db64e79c95d483cdcf97c38ec6ab4a49170ba.1691884800.git.me@tobias.gr>
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Thu, 23 Feb 2023 16:46:29 +0100
Subject: [PATCH 1/3] services: dnsmasq: Add more service options.

* gnu/services/dns.scm (dnsmasq-configuration, dnsmasq-shepherd-service): Add
options domain-needed?, bogus-priv?, filterwin2k?, poll?, local, interface,
bind-dynamic?, expand-hosts?, domain, dhcp-range, and dhcp-option, as they are
documented in dnsmasq's manual.
* doc/guix.texi (DNS Services): Document them.

Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr>
---
 doc/guix.texi        | 39 ++++++++++++++++++++++++++++
 gnu/services/dns.scm | 60 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 0af8c21796..a64ba36b5d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -117,6 +117,7 @@
 Copyright @copyright{} 2023 Nathaniel Nicandro@*
 Copyright @copyright{} 2023 Tanguy Le Carrour@*
 Copyright @copyright{} 2023 Brian Cully@*
+Copyright @copyright{} 2023 Gabriel Wicki@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -32463,6 +32464,44 @@ DNS Services
 If set, add a CPE (Customer-Premises Equipment) identifier to DNS
 queries which are forwarded upstream.
 
+@item @code{domain-needed?} (default: @code{#f})
+Whether to forward queries with no domain part.
+
+@item @code{bogus-priv?} (default: @code{#f})
+Whether to fake reverse lookups for RFC1918 private address ranges.
+
+@item @code{filterwin2k?} (default: @code{#f})
+Whether to forward spurious DNS requests from Windows hosts.
+
+@item @code{poll?} (default: @code{#t})
+Continuously reads @file{/etc/resolv.conf} when @code{#true}, otherwise only
+does so on SIGHUP.
+
+@item @code{local} (default: @code{#f})
+A string representing domains where nothing will be forwarded to
+@code{"/domain/"}).
+
+@item @code{interface} (default: @code{#f})
+The interface(s) dnsmasq works on (like @code{"wlp3"} or @code{"lan0"}.
+Multiple names can be specified as strings separated by commas.
+
+@item @code{bind-dynamic?} (default: @code{#f})
+Bind to interfaces in use - check for new interfaces.
+
+@item @code{expand-hosts?} (default: @code{#f})
+Expand simple names in @file{/etc/hosts} with domain-suffix.
+
+@item @code{domain} (default: @code{#f})
+Specify the domain to be assigned in DHCP leases.
+
+@item @code{dhcp-range} (default: @code{#f})
+Enable DHCP in the range given with lease duration, the format is
+@code{<START-IP>,<END-IP>,<MASK>,<LEASE-TIME>}, e.g.
+@code{192.0.2.50,192.0.2.150,255.255.255.0,1h}.
+
+@item @code{dhcp-options} (default: @code{'()})
+A list of options to be passed along.
+
 @item @code{tftp-enable?} (default: @code{#f})
 Whether to enable the built-in TFTP server.
 
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index f45fc99c69..ff93731ba3 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
+;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -765,6 +766,28 @@ (define-record-type* <dnsmasq-configuration>
                     (default #t))       ;boolean
   (cpe-id           dnsmasq-configuration-cpe-id
                     (default #f))       ;string
+  (domain-needed?   dnsmasq-configuration-domain-needed?
+                    (default #f))       ;boolean
+  (bogus-priv?      dnsmasq-configuration-bogus-priv?
+                    (default #f))       ;boolean
+  (filterwin2k?     dnsmasq-configuration-filterwin2k?
+                    (default #f))       ;boolean
+  (poll?            dnsmasq-configuration-poll?
+                    (default #t))       ;boolean
+  (local            dnsmasq-configuration-local
+                    (default #f))       ;string
+  (interface        dnsmasq-configuration-interface
+                    (default #f))       ;string
+  (bind-dynamic?    dnsmasq-configuration-bind-dynamic?
+                    (default #f))       ;boolean
+  (expand-hosts?    dnsmasq-configuration-expand-hosts?
+                    (default #f))       ;boolean
+  (domain           dnsmasq-configuration-domain
+                    (default #f))       ;string
+  (dhcp-range       dnsmasq-configuration-dhcp-range
+                    (default #f))       ;string
+  (dhcp-options      dnsmasq-configuration-dhcp-options
+                    (default '()))      ;list of string
   (tftp-enable?     dnsmasq-configuration-tftp-enable?
                     (default #f))       ;boolean
   (tftp-no-fail?    dnsmasq-configuration-tftp-no-fail?
@@ -798,6 +821,11 @@ (define (dnsmasq-shepherd-service config)
      servers addresses servers-file
      cache-size negative-cache?
      cpe-id
+     domain-needed? bogus-priv? filterwin2k? poll?
+     local interface
+     bind-dynamic? expand-hosts?
+     domain
+     dhcp-range dhcp-options
      tftp-enable? tftp-no-fail?
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
@@ -845,6 +873,38 @@ (define (dnsmasq-shepherd-service config)
                 #$@(if cpe-id
                        (list (format #f "--add-cpe-id=~a" cpe-id))
                        '())
+                #$@(if domain-needed?
+                       '("--domain-needed")
+                       '())
+                #$@(if bogus-priv?
+                       '("--bogus-priv")
+                       '())
+                #$@(if filterwin2k?
+                       '("--filterwin2k")
+                       '())
+                #$@(if poll?
+                       '()
+                       '("--no-poll"))
+                #$@(if local
+                       (list (format #f "--local=~a" local))
+                       '())
+                #$@(if interface
+                       (list (format #f "--interface=~a" interface))
+                       '())
+                #$@(if bind-dynamic?
+                       '("--bind-dynamic")
+                       '())
+                #$@(if expand-hosts?
+                       '("--expand-hosts")
+                       '())
+                #$@(if domain
+                       (list (format #f "--domain=~a" domain))
+                       '())
+                #$@(if dhcp-range
+                       (list (format #f "--dhcp-range=~a" dhcp-range))
+                       '())
+                #$@(map (cut format #f "--dhcp-option=~a" <>)
+                        dhcp-options)
                 #$@(if tftp-enable?
                        '("--enable-tftp")
                         '())

base-commit: 97d920387df7cc9502acd3f6ae84fed21fd12a4f
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-services-dnsmasq-Fix-some-indentation.patch --]
[-- Type: text/x-diff; name=0002-services-dnsmasq-Fix-some-indentation.patch, Size: 3839 bytes --]

From 279f143f6283f1a10875f039b613a22cace4c707 Mon Sep 17 00:00:00 2001
Message-ID: <279f143f6283f1a10875f039b613a22cace4c707.1691884801.git.me@tobias.gr>
In-Reply-To: <a55db64e79c95d483cdcf97c38ec6ab4a49170ba.1691884800.git.me@tobias.gr>
References: <a55db64e79c95d483cdcf97c38ec6ab4a49170ba.1691884800.git.me@tobias.gr>
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Sun, 13 Aug 2023 02:00:00 +0200
Subject: [PATCH 2/3] services: dnsmasq: Fix some indentation.

Let's make the next conflict resolution less painful.

* gnu/packages/dns.scm (dnsmasq-shepherd-service):
C-M-q MAKE-FORKEXEC-CONSTRUCTOR.
---
 gnu/services/dns.scm | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index ff93731ba3..fc70834deb 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -842,23 +842,23 @@ (define (dnsmasq-shepherd-service config)
                 "--pid-file=/run/dnsmasq.pid"
                 #$@(if no-hosts?
                        '("--no-hosts")
-                        '())
+                       '())
                 #$(format #f "--port=~a" port)
                 #$@(if local-service?
                        '("--local-service")
-                        '())
+                       '())
                 #$@(map (cut format #f "--listen-address=~a" <>)
                         listen-addresses)
                 #$(format #f "--resolv-file=~a" resolv-file)
                 #$@(if no-resolv?
                        '("--no-resolv")
-                        '())
+                       '())
                 #$@(if forward-private-reverse-lookup?
                        '()
-                        '("--bogus-priv"))
+                       '("--bogus-priv"))
                 #$@(if query-servers-in-order?
                        '("--strict-order")
-                        '())
+                       '())
                 #$@(if servers-file
                        (list #~(string-append "--servers-file=" #$servers-file))
                        '())
@@ -869,7 +869,7 @@ (define (dnsmasq-shepherd-service config)
                 #$(format #f "--cache-size=~a" cache-size)
                 #$@(if negative-cache?
                        '()
-                        '("--no-negcache"))
+                       '("--no-negcache"))
                 #$@(if cpe-id
                        (list (format #f "--add-cpe-id=~a" cpe-id))
                        '())
@@ -907,16 +907,16 @@ (define (dnsmasq-shepherd-service config)
                         dhcp-options)
                 #$@(if tftp-enable?
                        '("--enable-tftp")
-                        '())
+                       '())
                 #$@(if tftp-no-fail?
                        '("--tftp-no-fail")
-                        '())
+                       '())
                 #$@(if tftp-single-port?
                        '("--tftp-single-port")
-                        '())
+                       '())
                 #$@(if tftp-secure?
                        '("--tftp-secure")
-                        '())
+                       '())
                 #$@(if tftp-max
                        (list (format #f "--tftp-max=~a" tftp-max))
                        '())
@@ -925,10 +925,10 @@ (define (dnsmasq-shepherd-service config)
                        '())
                 #$@(if tftp-no-blocksize?
                        '("--tftp-no-blocksize")
-                        '())
+                       '())
                 #$@(if tftp-lowercase?
                        '("--tftp-lowercase")
-                        '())
+                       '())
                 #$@(if tftp-port-range
                        (list (format #f "--tftp-port-range=~a"
                                      tftp-port-range))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-f-dnsmasq.patch --]
[-- Type: text/x-diff; name=0003-f-dnsmasq.patch, Size: 10007 bytes --]

From ba0c0fd40a4efc72681d3fe6d8ab229fcaff8781 Mon Sep 17 00:00:00 2001
Message-ID: <ba0c0fd40a4efc72681d3fe6d8ab229fcaff8781.1691884801.git.me@tobias.gr>
In-Reply-To: <a55db64e79c95d483cdcf97c38ec6ab4a49170ba.1691884800.git.me@tobias.gr>
References: <a55db64e79c95d483cdcf97c38ec6ab4a49170ba.1691884800.git.me@tobias.gr>
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Sun, 13 Aug 2023 02:00:00 +0200
Subject: [PATCH 3/3] f dnsmasq

---
 doc/guix.texi        | 96 +++++++++++++++++++++++++++++++++++---------
 gnu/services/dns.scm | 47 +++++++++++-----------
 2 files changed, 99 insertions(+), 44 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a64ba36b5d..8ce1408508 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32465,42 +32465,98 @@ DNS Services
 queries which are forwarded upstream.
 
 @item @code{domain-needed?} (default: @code{#f})
-Whether to forward queries with no domain part.
+@code{#t} tells dnsmasq to never forward A or AAAA queries for plain
+names, without dots or domain parts, to upstream nameservers.
+If the name is not known from @file{/etc/hosts} or DHCP then a ``not found''
+answer is returned.
 
 @item @code{bogus-priv?} (default: @code{#f})
-Whether to fake reverse lookups for RFC1918 private address ranges.
+Whether to fake bogus reverse lookups for RFC6303 private address ranges.
+All reverse lookups for private IP ranges (e.g. 192.168.x.x) which are not
+found in @file{/etc/hosts} or the DHCP leases file are answered with
+``no such domain'' rather than being forwarded upstream.
 
 @item @code{filterwin2k?} (default: @code{#f})
-Whether to forward spurious DNS requests from Windows hosts.
+Whether to block spurious DNS requests periodically made by hosts running
+Windows, which don't get sensible answers from the public DNS.
 
 @item @code{poll?} (default: @code{#t})
-Continuously reads @file{/etc/resolv.conf} when @code{#true}, otherwise only
-does so on SIGHUP.
+When @code{#t}, continuously check @file{/etc/resolv.conf} for changes.
+Otherwise do so only on SIGHUP.
 
-@item @code{local} (default: @code{#f})
-A string representing domains where nothing will be forwarded to
-@code{"/domain/"}).
+@item @code{interfaces} (default: @code{'()})
+Listen only on the specified list of interfaces, such as @code{"wlp3"}
+or @code{"lan0"}.  The local (loopback) interface is added automatically.
+If this list is empty, listen on all available interfaces.
 
-@item @code{interface} (default: @code{#f})
-The interface(s) dnsmasq works on (like @code{"wlp3"} or @code{"lan0"}.
-Multiple names can be specified as strings separated by commas.
+When @code{bind-dynamic?} is set on Linux, IP alias interface labels
+such as @code{"eth1:0"} will be checked rather than interface names.
+
+@item @code{bind-interfaces?} (default: @code{#f})
+XXX TODO
 
 @item @code{bind-dynamic?} (default: @code{#f})
-Bind to interfaces in use - check for new interfaces.
+When @code{#t}, bind to the address of the network interfaces
+currently in use, allowing for multiple Dnsmasq instances.
+Moreover, automatically listen on any new interfaces or addresses
+that appear later on---subject to access control configuration.
+
+This mode is available only on Linux.  On other kernels, it will fall
+back to @code{bind-interfaces?} mode.
 
 @item @code{expand-hosts?} (default: @code{#f})
-Expand simple names in @file{/etc/hosts} with domain-suffix.
+Add the domain to simple names (those without a period) in
+@file{/etc/hosts} in the same way as for DHCP-derived names.  This does
+not apply to domain names in cnames, PTR records, TXT records, etc.
 
-@item @code{domain} (default: @code{#f})
-Specify the domain to be assigned in DHCP leases.
+@item @code{domains} (default: @code{'()})
+A list of strings describing DNS domains for the DHCP server.  Domains
+may be be given unconditionally (without the IP range) or for limited
+IP ranges.
+
+This has two effects; firstly it causes the DHCP server to return the
+domain to any hosts which request it, and secondly it sets the domain
+which it is legal for DHCP-configured hosts to claim.
+
+If a domain suffix is specified, then hostnames with a domain part are
+allowed, provided the domain part matches the suffix.  Hostnames
+without a domain part have the suffix added as an optional domain part.
+
+If no domain suffix is specified, then any DHCP hostname with a domain
+part (i.e., with a period) will be disallowed and logged.
 
-@item @code{dhcp-range} (default: @code{#f})
-Enable DHCP in the range given with lease duration, the format is
-@code{<START-IP>,<END-IP>,<MASK>,<LEASE-TIME>}, e.g.
-@code{192.0.2.50,192.0.2.150,255.255.255.0,1h}.
+@item @code{dhcp-ranges} (default: @code{'()})
+Whether to enable the DHCP server for the given range(s).  Each range
+is a string that commonly follows the format
+@code{<start-addr>,<end-addr>[,<prefix-length>[,<lease-time>]]}, e.g.
+@code{"192.0.2.50,192.0.2.150,255.255.255.0,1h"}.
+
+IP addresses will be given out (``leased'') from the range
+@code{<start-addr>} to @code{<end-addr>}, with an optional
+@code{<prefix-length>}.
+@comment …and from statically defined addresses given in --dhcp-host options.
+
+@code{<lease-time>} is optional.  If given, leases will be valid
+for that length of time: in seconds if no unit is given (e.g.,
+@code{45m}, @code{12h}, @code{7d}, @code{1w}), or @code{infinite}.
+
+Refer to the dnsmasq(8) man page for more options and information.
 
 @item @code{dhcp-options} (default: @code{'()})
-A list of options to be passed along.
+A list of DHCP option strings as listed in the output of
+@command{dnsmasq --help dhcp} and @command{dnsmasq --help dhcp6}.
+
+You can use both numerical options and their readable names:
+
+@lisp
+;; This friendly list…
+(list "option:router,1.2.3.4"
+      "option6:dns-server,[::],[1234::88]")
+
+;; …is equivalent to this one.
+(list "3,1.2.3.4"
+      "23,[::],[1234::88]")
+@end lisp
 
 @item @code{tftp-enable?} (default: @code{#f})
 Whether to enable the built-in TFTP server.
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index fc70834deb..4a0e29413f 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
 ;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2023 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -774,19 +775,19 @@ (define-record-type* <dnsmasq-configuration>
                     (default #f))       ;boolean
   (poll?            dnsmasq-configuration-poll?
                     (default #t))       ;boolean
-  (local            dnsmasq-configuration-local
-                    (default #f))       ;string
-  (interface        dnsmasq-configuration-interface
-                    (default #f))       ;string
+  (interfaces       dnsmasq-configuration-interfaces
+                    (default '()))      ;list of string
+  (bind-interfaces? dnsmasq-configuration-bind-interfaces?
+                    (default #f))       ;boolean
   (bind-dynamic?    dnsmasq-configuration-bind-dynamic?
                     (default #f))       ;boolean
   (expand-hosts?    dnsmasq-configuration-expand-hosts?
                     (default #f))       ;boolean
-  (domain           dnsmasq-configuration-domain
-                    (default #f))       ;string
-  (dhcp-range       dnsmasq-configuration-dhcp-range
-                    (default #f))       ;string
-  (dhcp-options      dnsmasq-configuration-dhcp-options
+  (domains          dnsmasq-configuration-domains
+                    (default '()))      ;list of string
+  (dhcp-ranges      dnsmasq-configuration-dhcp-ranges
+                    (default '()))      ;list of string
+  (dhcp-options     dnsmasq-configuration-dhcp-options
                     (default '()))      ;list of string
   (tftp-enable?     dnsmasq-configuration-tftp-enable?
                     (default #f))       ;boolean
@@ -822,10 +823,10 @@ (define (dnsmasq-shepherd-service config)
      cache-size negative-cache?
      cpe-id
      domain-needed? bogus-priv? filterwin2k? poll?
-     local interface
-     bind-dynamic? expand-hosts?
-     domain
-     dhcp-range dhcp-options
+     interfaces
+     bind-interfaces? bind-dynamic? expand-hosts?
+     domains
+     dhcp-ranges dhcp-options
      tftp-enable? tftp-no-fail?
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
@@ -885,11 +886,11 @@ (define (dnsmasq-shepherd-service config)
                 #$@(if poll?
                        '()
                        '("--no-poll"))
-                #$@(if local
-                       (list (format #f "--local=~a" local))
-                       '())
-                #$@(if interface
-                       (list (format #f "--interface=~a" interface))
+                #$@(if (null? interfaces)
+		       '()
+                       (list (format #f "--interface=~{~a~^,~}" interfaces)))
+                #$@(if bind-interfaces?
+                       '("--bind-interfaces")
                        '())
                 #$@(if bind-dynamic?
                        '("--bind-dynamic")
@@ -897,12 +898,10 @@ (define (dnsmasq-shepherd-service config)
                 #$@(if expand-hosts?
                        '("--expand-hosts")
                        '())
-                #$@(if domain
-                       (list (format #f "--domain=~a" domain))
-                       '())
-                #$@(if dhcp-range
-                       (list (format #f "--dhcp-range=~a" dhcp-range))
-                       '())
+                #$@(map (cut format #f "--domain=~a" <>)
+                        domains)
+                #$@(map (cut format #f "--dhcp-range=~a" <>)
+                        dhcp-ranges)
                 #$@(map (cut format #f "--dhcp-option=~a" <>)
                         dhcp-options)
                 #$@(if tftp-enable?
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#61869] Review of the third patch
  2023-02-28 13:36 [bug#61869] gnu: services: Add more dnsmasq options Wicki Gabriel (wicg)
  2023-03-08 14:56 ` [bug#61869] Updated patch Wicki Gabriel (wicg)
  2023-08-15 15:20 ` [bug#61869] gnu: services: Add more dnsmasq options Tobias Geerinckx-Rice via Guix-patches via
@ 2023-08-21 15:12 ` Wicki Gabriel (wicg)
  2 siblings, 0 replies; 4+ messages in thread
From: Wicki Gabriel (wicg) @ 2023-08-21 15:12 UTC (permalink / raw)
  To: 61869@debbugs.gnu.org; +Cc: me@tobias.gr


[-- Attachment #1.1: Type: text/plain, Size: 557 bytes --]

Thank you very much for your review and the third patch!

I have 3 small additions to your work (see your adapted patch in the attachments):

  *   I added a commit message (although I guess you'll edit that again anyways)
  *   I extended your explanations on the `interface' option (when bind-dynamic​?` or​ bind-interfaces?​ is set...)
  *   I filled in your TODO

Please let me know (don't forget to cc me in your reply) if I can do anything else to merge this patch-set.

Thanks again, for your time, patience and expertise

gabriel

[-- Attachment #1.2: Type: text/html, Size: 1875 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-services-dnsmasq-Fix-inconsistencies.patch --]
[-- Type: text/x-patch; name="0003-services-dnsmasq-Fix-inconsistencies.patch", Size: 10653 bytes --]

From a6a696994f7d5ef58f85b4aaa14c088428e49353 Mon Sep 17 00:00:00 2001
Message-Id: <a6a696994f7d5ef58f85b4aaa14c088428e49353.1692630490.git.wicg@zhaw.ch>
In-Reply-To: <185f1c3a6523eae9f59ebf9a9789405305c6a1c4.1692630490.git.wicg@zhaw.ch>
References: <185f1c3a6523eae9f59ebf9a9789405305c6a1c4.1692630490.git.wicg@zhaw.ch>
From: Gabriel Wicki <gabriel@erlikon.ch>
Date: Mon, 21 Aug 2023 16:57:19 +0200
Subject: [PATCH 3/3] services: dnsmasq: Fix inconsistencies.

* doc/guix.texi: Adapt the service documentation to reflect dnsmasq's
man-pages.
* gnu/services/dns.scm (<dnsmasq-configuration>): [interface, domain,
dhcp-range, dhcp-options] Rename fields to reflect object type (i.e. plural
for lists).  [local] Remove option (this is an alias for servers).
[bind-interfaces?] New option.
---
 doc/guix.texi        | 100 ++++++++++++++++++++++++++++++++++---------
 gnu/services/dns.scm |  47 ++++++++++----------
 2 files changed, 103 insertions(+), 44 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index ba8f8a52ce..1a65d33228 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32472,42 +32472,102 @@ DNS Services
 queries which are forwarded upstream.
 
 @item @code{domain-needed?} (default: @code{#f})
-Whether to forward queries with no domain part.
+@code{#t} tells dnsmasq to never forward A or AAAA queries for plain
+names, without dots or domain parts, to upstream nameservers.
+If the name is not known from @file{/etc/hosts} or DHCP then a ``not found''
+answer is returned.
 
 @item @code{bogus-priv?} (default: @code{#f})
-Whether to fake reverse lookups for RFC1918 private address ranges.
+Whether to fake bogus reverse lookups for RFC6303 private address ranges.
+All reverse lookups for private IP ranges (e.g. 192.168.x.x) which are not
+found in @file{/etc/hosts} or the DHCP leases file are answered with
+``no such domain'' rather than being forwarded upstream.
 
 @item @code{filterwin2k?} (default: @code{#f})
-Whether to forward spurious DNS requests from Windows hosts.
+Whether to block spurious DNS requests periodically made by hosts running
+Windows, which don't get sensible answers from the public DNS.
 
 @item @code{poll?} (default: @code{#t})
-Continuously reads @file{/etc/resolv.conf} when @code{#true}, otherwise only
-does so on SIGHUP.
+When @code{#t}, continuously check @file{/etc/resolv.conf} for changes.
+Otherwise do so only on SIGHUP.
 
-@item @code{local} (default: @code{#f})
-A string representing domains where nothing will be forwarded to
-@code{"/domain/"}).
+@item @code{interfaces} (default: @code{'()})
+Listen only on the specified list of interfaces, such as @code{"wlp3"}
+or @code{"lan0"}.  The local (loopback) interface is added automatically.
+If this list is empty, listen on all available interfaces.
 
-@item @code{interface} (default: @code{#f})
-The interface(s) dnsmasq works on (like @code{"wlp3"} or @code{"lan0"}.
-Multiple names can be specified as strings separated by commas.
+When @code{bind-dynamic?} or @code{bind-interfaces?} is set on Linux, IP
+alias interface labels such as @code{"eth1:0"} will be checked rather
+than interface names.
+
+@item @code{bind-interfaces?} (default: @code{#f})
+When @code{#t} on systems which support it, dnsmasq binds the wildcard
+address, to discard requests for interfaces it is not supposed to reply
+to later.  This should only be necessary when running another nameserver
+(or another instance of dnsmasq) on the same machine.
 
 @item @code{bind-dynamic?} (default: @code{#f})
-Bind to interfaces in use - check for new interfaces.
+When @code{#t}, bind to the address of the network interfaces
+currently in use, allowing for multiple Dnsmasq instances.
+Moreover, automatically listen on any new interfaces or addresses
+that appear later on---subject to access control configuration.
+
+This mode is available only on Linux.  On other kernels, it will fall
+back to @code{bind-interfaces?} mode.
 
 @item @code{expand-hosts?} (default: @code{#f})
-Expand simple names in @file{/etc/hosts} with domain-suffix.
+Add the domain to simple names (those without a period) in
+@file{/etc/hosts} in the same way as for DHCP-derived names.  This does
+not apply to domain names in cnames, PTR records, TXT records, etc.
 
-@item @code{domain} (default: @code{#f})
-Specify the domain to be assigned in DHCP leases.
+@item @code{domains} (default: @code{'()})
+A list of strings describing DNS domains for the DHCP server.  Domains
+may be be given unconditionally (without the IP range) or for limited
+IP ranges.
+
+This has two effects; firstly it causes the DHCP server to return the
+domain to any hosts which request it, and secondly it sets the domain
+which it is legal for DHCP-configured hosts to claim.
+
+If a domain suffix is specified, then hostnames with a domain part are
+allowed, provided the domain part matches the suffix.  Hostnames
+without a domain part have the suffix added as an optional domain part.
+
+If no domain suffix is specified, then any DHCP hostname with a domain
+part (i.e., with a period) will be disallowed and logged.
 
-@item @code{dhcp-range} (default: @code{#f})
-Enable DHCP in the range given with lease duration, the format is
-@code{<START-IP>,<END-IP>,<MASK>,<LEASE-TIME>}, e.g.
-@code{192.0.2.50,192.0.2.150,255.255.255.0,1h}.
+@item @code{dhcp-ranges} (default: @code{'()})
+Whether to enable the DHCP server for the given range(s).  Each range
+is a string that commonly follows the format
+@code{<start-addr>,<end-addr>[,<prefix-length>[,<lease-time>]]}, e.g.
+@code{"192.0.2.50,192.0.2.150,255.255.255.0,1h"}.
+
+IP addresses will be given out (``leased'') from the range
+@code{<start-addr>} to @code{<end-addr>}, with an optional
+@code{<prefix-length>}.
+@comment …and from statically defined addresses given in --dhcp-host options.
+
+@code{<lease-time>} is optional.  If given, leases will be valid
+for that length of time: in seconds if no unit is given (e.g.,
+@code{45m}, @code{12h}, @code{7d}, @code{1w}), or @code{infinite}.
+
+Refer to the dnsmasq(8) man page for more options and information.
 
 @item @code{dhcp-options} (default: @code{'()})
-A list of options to be passed along.
+A list of DHCP option strings as listed in the output of
+@command{dnsmasq --help dhcp} and @command{dnsmasq --help dhcp6}.
+
+You can use both numerical options and their readable names:
+
+@lisp
+;; This friendly list…
+(list "option:router,1.2.3.4"
+      "option6:dns-server,[::],[1234::88]")
+
+;; …is equivalent to this one.
+(list "3,1.2.3.4"
+      "23,[::],[1234::88]")
+@end lisp
 
 @item @code{tftp-enable?} (default: @code{#f})
 Whether to enable the built-in TFTP server.
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 17dec9ad8a..33af84e621 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
 ;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
 ;;; Copyright © 2023 Gabriel Wicki <gabriel@erlikon.ch>
+;;; Copyright © 2023 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -774,19 +775,19 @@ (define-record-type* <dnsmasq-configuration>
                     (default #f))       ;boolean
   (poll?            dnsmasq-configuration-poll?
                     (default #t))       ;boolean
-  (local            dnsmasq-configuration-local
-                    (default #f))       ;string
-  (interface        dnsmasq-configuration-interface
-                    (default #f))       ;string
+  (interfaces       dnsmasq-configuration-interfaces
+                    (default '()))      ;list of string
+  (bind-interfaces? dnsmasq-configuration-bind-interfaces?
+                    (default #f))       ;boolean
   (bind-dynamic?    dnsmasq-configuration-bind-dynamic?
                     (default #f))       ;boolean
   (expand-hosts?    dnsmasq-configuration-expand-hosts?
                     (default #f))       ;boolean
-  (domain           dnsmasq-configuration-domain
-                    (default #f))       ;string
-  (dhcp-range       dnsmasq-configuration-dhcp-range
-                    (default #f))       ;string
-  (dhcp-options      dnsmasq-configuration-dhcp-options
+  (domains          dnsmasq-configuration-domains
+                    (default '()))      ;list of string
+  (dhcp-ranges      dnsmasq-configuration-dhcp-ranges
+                    (default '()))      ;list of string
+  (dhcp-options     dnsmasq-configuration-dhcp-options
                     (default '()))      ;list of string
   (tftp-enable?     dnsmasq-configuration-tftp-enable?
                     (default #f))       ;boolean
@@ -822,10 +823,10 @@ (define (dnsmasq-shepherd-service config)
      cache-size negative-cache?
      cpe-id
      domain-needed? bogus-priv? filterwin2k? poll?
-     local interface
-     bind-dynamic? expand-hosts?
-     domain
-     dhcp-range dhcp-options
+     interfaces
+     bind-interfaces? bind-dynamic? expand-hosts?
+     domains
+     dhcp-ranges dhcp-options
      tftp-enable? tftp-no-fail?
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
@@ -885,11 +886,11 @@ (define (dnsmasq-shepherd-service config)
                 #$@(if poll?
                        '()
                        '("--no-poll"))
-                #$@(if local
-                       (list (format #f "--local=~a" local))
-                       '())
-                #$@(if interface
-                       (list (format #f "--interface=~a" interface))
+                #$@(if (null? interfaces)
+		       '()
+                       (list (format #f "--interface=~{~a~^,~}" interfaces)))
+                #$@(if bind-interfaces?
+                       '("--bind-interfaces")
                        '())
                 #$@(if bind-dynamic?
                        '("--bind-dynamic")
@@ -897,12 +898,10 @@ (define (dnsmasq-shepherd-service config)
                 #$@(if expand-hosts?
                        '("--expand-hosts")
                        '())
-                #$@(if domain
-                       (list (format #f "--domain=~a" domain))
-                       '())
-                #$@(if dhcp-range
-                       (list (format #f "--dhcp-range=~a" dhcp-range))
-                       '())
+                #$@(map (cut format #f "--domain=~a" <>)
+                        domains)
+                #$@(map (cut format #f "--dhcp-range=~a" <>)
+                        dhcp-ranges)
                 #$@(map (cut format #f "--dhcp-option=~a" <>)
                         dhcp-options)
                 #$@(if tftp-enable?
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-21 15:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 13:36 [bug#61869] gnu: services: Add more dnsmasq options Wicki Gabriel (wicg)
2023-03-08 14:56 ` [bug#61869] Updated patch Wicki Gabriel (wicg)
2023-08-15 15:20 ` [bug#61869] gnu: services: Add more dnsmasq options Tobias Geerinckx-Rice via Guix-patches via
2023-08-21 15:12 ` [bug#61869] Review of the third patch Wicki Gabriel (wicg)

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.