GNU logs - #77204, boring messages


Message sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77204] [PATCH 0/3] dnsmasq service changes
Resent-From: Alexey Abramov <levenson@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN
Resent-Date: Sun, 23 Mar 2025 10:27:04 +0000
Resent-Message-ID: <handler.77204.B.174272556622725 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 77204
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77204 <at> debbugs.gnu.org
Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.174272556622725
          (code B ref -1); Sun, 23 Mar 2025 10:27:04 +0000
Received: (at submit) by debbugs.gnu.org; 23 Mar 2025 10:26:06 +0000
Received: from localhost ([127.0.0.1]:47806 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twIWs-0005uN-AM
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:26:06 -0400
Received: from lists.gnu.org ([2001:470:142::17]:34594)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <levenson@HIDDEN>) id 1twIWo-0005rg-Cu
 for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:26:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <levenson@HIDDEN>) id 1twIWc-00011c-S0
 for guix-patches@HIDDEN; Sun, 23 Mar 2025 06:25:51 -0400
Received: from mail.mmer.org ([178.22.65.174])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <levenson@HIDDEN>) id 1twIWY-00045U-GJ
 for guix-patches@HIDDEN; Sun, 23 Mar 2025 06:25:49 -0400
Received: from mail.mmer.org (localhost [127.0.0.1])
 by mail.mmer.org (OpenSMTPD) with ESMTP id ddabe32b
 for <guix-patches@HIDDEN>; Sun, 23 Mar 2025 10:25:38 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to
 :subject:date:message-id:mime-version:content-transfer-encoding;
 s=dkim; bh=4X5Hf7GoYvaPjhIK5J56RD3Kep4Kjn63FUKAgn5hTNA=; b=pt/R
 I5x3h25I3E2Nn7FjsPuDqhqb6O/zlAhYIyEvEJTptzYAe5bpoZiwbn68wC+DZmTd
 wjSOj/hCUrq0O3H2K7jhUKPaMrb0rKeAhFtqS+XrKtxLIr75d9/LQsLqcTdITzhi
 v3GrP7GorOsaMsPQYsKJSRTTxppe7HTTMfjRc+k=
Received: from delta (16-254-250-62.ftth.glasoperator.nl [62.250.254.16])
 by mail.mmer.org (OpenSMTPD) with ESMTPSA id f419e6a3
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <guix-patches@HIDDEN>;
 Sun, 23 Mar 2025 10:25:38 +0000 (UTC)
From: Alexey Abramov <levenson@HIDDEN>
Date: Sun, 23 Mar 2025 11:24:30 +0100
Message-ID: <cover.1742725327.git.levenson@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=178.22.65.174; envelope-from=levenson@HIDDEN;
 helo=mail.mmer.org
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

Hi all,

With these patches, I would like to add extra fields to be able to run
multiple instances of dnsmasq. I am using dnsmasq as a local dns server and
also as a dhcp for bootstraping nodes over the network. The important thing is
that I renamed `provision' field here to shepherd-provision. AFAIK
`shepherd-provision' and `shepherd-requirement' are the names we use with
other services.


Alexey Abramov (3):
  services: dnsmasq: Provide shepherd-provision and shepherd-requirement
    fields.
  services: dnsmasq: Provide pid-file, conf-file and conf-dir
    configuration fields.
  services: dnsmasq: Provide stats and reload actions.

 doc/guix.texi            |  35 ++++++-
 gnu/services/dns.scm     | 196 ++++++++++++++++++++++++++-------------
 gnu/tests/networking.scm |  98 ++++++++++++++++++++
 3 files changed, 263 insertions(+), 66 deletions(-)

-- 
2.48.1





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Alexey Abramov <levenson@HIDDEN>
Subject: bug#77204: Acknowledgement ([PATCH 0/3] dnsmasq service changes)
Message-ID: <handler.77204.B.174272556622725.ack <at> debbugs.gnu.org>
References: <cover.1742725327.git.levenson@HIDDEN>
X-Gnu-PR-Message: ack 77204
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 77204 <at> debbugs.gnu.org
Date: Sun, 23 Mar 2025 10:27:04 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

As you requested using X-Debbugs-CC, your message was also forwarded to
  Ludovic Court=C3=A8s <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@gma=
il.com>
(after having been given a bug report number, if it did not have one).

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 77204 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
77204: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77204
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77204] [PATCH 1/3] services: dnsmasq: Provide shepherd-provision and shepherd-requirement fields.
Resent-From: Alexey Abramov <levenson@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN
Resent-Date: Sun, 23 Mar 2025 10:29:03 +0000
Resent-Message-ID: <handler.77204.B77204.174272568824004 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77204
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77204 <at> debbugs.gnu.org
Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by 77204-submit <at> debbugs.gnu.org id=B77204.174272568824004
          (code B ref 77204); Sun, 23 Mar 2025 10:29:03 +0000
Received: (at 77204) by debbugs.gnu.org; 23 Mar 2025 10:28:08 +0000
Received: from localhost ([127.0.0.1]:47813 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twIYn-0006Eb-2A
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:07 -0400
Received: from mail.mmer.org ([178.22.65.174]:57980)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <levenson@HIDDEN>) id 1twIYk-0006Co-35
 for 77204 <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:03 -0400
Received: from mail.mmer.org (localhost [127.0.0.1])
 by mail.mmer.org (OpenSMTPD) with ESMTP id 0b255a0c
 for <77204 <at> debbugs.gnu.org>; Sun, 23 Mar 2025 10:27:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=nZ492XzQdNs8jTvundVjer889
 g/FWnLnE9bmrl0fEn8=; b=yGFFRBxj9zpU8WUlln4lmfFdNCGS2Zo7Xl7OGzOjG
 fmwxRraABI90qHrKOb9vX3U7U2B9JC9fFC+mmwwpuxgfhmoWmXX7lentIxx9nRgj
 dgI3j9weD7Qfj0b82o8IWJFKbHWYdk1iNI3S9J+PGQMzsTdWnDQHYtb0Ahn90Zu4
 04=
Received: from delta (16-254-250-62.ftth.glasoperator.nl [62.250.254.16])
 by mail.mmer.org (OpenSMTPD) with ESMTPSA id c3efe54d
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <77204 <at> debbugs.gnu.org>;
 Sun, 23 Mar 2025 10:27:54 +0000 (UTC)
From: Alexey Abramov <levenson@HIDDEN>
Date: Sun, 23 Mar 2025 11:27:50 +0100
Message-ID: <242697cdc4ed0e257df4ba35500ae2a3b3a00a0b.1742725327.git.levenson@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <cover.1742725327.git.levenson@HIDDEN>
References: <cover.1742725327.git.levenson@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* doc/guix.texi: Document the change.
* gnu/services/dns.scm (<dnsmasq-configuration>)[provision]: Rename the field to
[shepherd-provision] for consistency with other services.
* gnu/services/dns.scm (<dnsmasq-configuration>)[shepherd-requirement]: New field.
* gnu/services/dns.scm (dnsmasq-shepherd-service): Use newly-created fields.
---
 doc/guix.texi        | 11 ++++++++---
 gnu/services/dns.scm | 12 ++++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index eecc0aec52c..fd6a0176348 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -35172,9 +35172,14 @@ DNS Services
 @item @code{package} (default: @var{dnsmasq})
 Package object of the dnsmasq server.
 
-@item @code{provision} (default: @code{'(dnsmasq)})
-A list of symbols for the Shepherd service corresponding to this dnsmasq
-configuration.
+@item @code{shepherd-provision} (default: @code{'(dnsmasq)})
+@itemx @code{shepherd-requirement} (default: @code{'(user-processes networking)})
+This option can be used to provide a list of Shepherd service names
+(symbols) provided by this service. You might want to change the default
+value if you intend to run several @command{dnsmasq} instances.
+
+Likewise, @code{shepherd-requirement} is a list of Shepherd service names
+(symbols) that this service will depend on.
 
 @item @code{no-hosts?} (default: @code{#f})
 When true, don't read the hostnames in /etc/hosts.
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 05291eb65d9..9276504ffd0 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -742,8 +742,10 @@ (define-record-type* <dnsmasq-configuration>
   dnsmasq-configuration?
   (package          dnsmasq-configuration-package
                     (default dnsmasq))  ;file-like
-  (provision        dnsmasq-provision
-                    (default '(dnsmasq)))
+  (shepherd-provision           dnsmasq-configuration-shepherd-provision
+                                (default '(dnsmasq)))
+  (shepherd-requirement         dnsmasq-configuration-shepherd-requirement
+                                (default '(user-processes networking)))
   (no-hosts?        dnsmasq-configuration-no-hosts?
                     (default #f))       ;boolean
   (port             dnsmasq-configuration-port
@@ -802,6 +804,8 @@ (define-record-type* <dnsmasq-configuration>
 (define (dnsmasq-shepherd-service config)
   (match-record config <dnsmasq-configuration>
     (package
+     shepherd-provision
+     shepherd-requirement
      no-hosts?
      port local-service? listen-addresses
      resolv-file no-resolv?
@@ -815,8 +819,8 @@ (define (dnsmasq-shepherd-service config)
      tftp-lowercase? tftp-port-range
      tftp-root tftp-unique-root extra-options)
     (shepherd-service
-     (provision (dnsmasq-provision config))
-     (requirement '(user-processes networking))
+     (provision shepherd-provision)
+     (requirement shepherd-requirement)
      (documentation "Run the dnsmasq DNS server.")
      (start #~(make-forkexec-constructor
                (list
-- 
2.48.1





Message sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77204] [PATCH 2/3] services: dnsmasq: Provide pid-file, conf-file and conf-dir configuration fields.
Resent-From: Alexey Abramov <levenson@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN
Resent-Date: Sun, 23 Mar 2025 10:29:04 +0000
Resent-Message-ID: <handler.77204.B77204.174272569924082 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77204
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77204 <at> debbugs.gnu.org
Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by 77204-submit <at> debbugs.gnu.org id=B77204.174272569924082
          (code B ref 77204); Sun, 23 Mar 2025 10:29:04 +0000
Received: (at 77204) by debbugs.gnu.org; 23 Mar 2025 10:28:19 +0000
Received: from localhost ([127.0.0.1]:47816 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twIZ0-0006GC-5U
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:19 -0400
Received: from mail.mmer.org ([178.22.65.174]:57980)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <levenson@HIDDEN>) id 1twIYl-0006Co-Nm
 for 77204 <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:08 -0400
Received: from mail.mmer.org (localhost [127.0.0.1])
 by mail.mmer.org (OpenSMTPD) with ESMTP id 0999a66f
 for <77204 <at> debbugs.gnu.org>; Sun, 23 Mar 2025 10:27:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=5y4A3GRIfCOY0LjwBg+3T3se5
 jzSHyW8aFz5ToPBT/Q=; b=63HWdeACuytkIhLMKzdwDAhmTcoyIL4RiTaXMUJH1
 zPLuEuN1dXrPGbaOWAcQOgClMVr5Gevw5po9iT8KVLouKAE3+I6ll50+7lO1SE/3
 RAOVFXRzyPlLb19vLnWDJbM5vMS0CKuFF2KZs9q/Hr3W59e50Uc1/rKRMkVQb+sZ
 Qo=
Received: from delta (16-254-250-62.ftth.glasoperator.nl [62.250.254.16])
 by mail.mmer.org (OpenSMTPD) with ESMTPSA id f62bf9f7
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <77204 <at> debbugs.gnu.org>;
 Sun, 23 Mar 2025 10:27:54 +0000 (UTC)
From: Alexey Abramov <levenson@HIDDEN>
Date: Sun, 23 Mar 2025 11:27:51 +0100
Message-ID: <84d4829a1add2c0960b36c4af3cb0ff2c240645f.1742725327.git.levenson@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <cover.1742725327.git.levenson@HIDDEN>
References: <cover.1742725327.git.levenson@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* doc/guix.texi: Document it.
* gnu/services/dns.scm: Export all record accessors.
* gnu/services/dns.scm (<dnsmasq-configuration>)[pid-file]: New
field.
* gnu/services/dns.scm (<dnsmasq-configuration>)[conf-file]: New field.
* gnu/services/dns.scm (<dnsmasq-configuration>)[conf-dir]: New field.
* gnu/services/dns.scm (<dnsmasq-configuration>)[extra-options]: Move
it to the end of the definition, because it is a last resort.
* gnu/services/dns.scm (dnsmasq-shepherd-service): Use newly-created fields.
---
 doc/guix.texi        |  14 ++++
 gnu/services/dns.scm | 162 +++++++++++++++++++++++++++----------------
 2 files changed, 117 insertions(+), 59 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fd6a0176348..a6996e30358 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -35181,6 +35181,9 @@ DNS Services
 Likewise, @code{shepherd-requirement} is a list of Shepherd service names
 (symbols) that this service will depend on.
 
+@item @code{pid-file} (default: @code{"/run/dnsmasq.pid"})
+Specify an alternate path for dnsmasq to record its process-id in.
+
 @item @code{no-hosts?} (default: @code{#f})
 When true, don't read the hostnames in /etc/hosts.
 
@@ -35301,6 +35304,17 @@ DNS Services
 resolving MAC addresses is only possible if the client is in the local
 network or obtained a DHCP lease from dnsmasq.
 
+@item @code{conf-file} (default: @code{'()})
+Specify a configuration file or multiple.  The given value should be a list of
+string paths to the configuration files. File-like objects are also supported.
+
+@item @code{conf-dir} (default: @code{#f})
+Read all the files in the given directory as configuration
+files. @command{dnsmasq} also supports extensions for the field, but
+here it is not implemented. It is more convenient to make
+@code{computed-file} directory in the store and use that. Files are
+loaded in alphabetical order of filename.
+
 @item @code{extra-options} (default: @code{'()})
 This option provides an ``escape hatch'' for the user to provide arbitrary
 command-line arguments to @command{dnsmasq} as a list of strings.
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 9276504ffd0..6e2ec7c2067 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -54,6 +54,38 @@ (define-module (gnu services dns)
 
             dnsmasq-service-type
             dnsmasq-configuration
+            dnsmasq-configuration-package
+            dnsmasq-configuration-shepherd-provision
+            dnsmasq-configuration-shepherd-requirement
+            dnsmasq-configuration-pid-file
+            dnsmasq-configuration-no-hosts?
+            dnsmasq-configuration-port
+            dnsmasq-configuration-local-service?
+            dnsmasq-configuration-listen-address
+            dnsmasq-configuration-resolv-file
+            dnsmasq-configuration-no-resolv?
+            dnsmasq-configuration-forward-private-reverse-lookup?
+            dnsmasq-configuration-query-servers-in-order?
+            dnsmasq-configuration-servers
+            dnsmasq-configuration-servers-file
+            dnsmasq-configuration-addresses
+            dnsmasq-configuration-cache-size
+            dnsmasq-configuration-negative-cache?
+            dnsmasq-configuration-cpe-id
+            dnsmasq-configuration-tftp-enable?
+            dnsmasq-configuration-tftp-no-fail?
+            dnsmasq-configuration-tftp-single-port?
+            dnsmasq-tftp-secure?
+            dnsmasq-tftp-max
+            dnsmasq-tftp-mtu
+            dnsmasq-tftp-no-blocksize?
+            dnsmasq-tftp-lowercase?
+            dnsmasq-tftp-port-range
+            dnsmasq-tftp-root
+            dnsmasq-tftp-unique-root
+            dnsmasq-configuration-conf-file
+            dnsmasq-configuration-conf-dir
+            dnsmasq-configuration-extra-options
 
             unbound-service-type
             unbound-configuration
@@ -740,72 +772,77 @@ (define knot-resolver-service-type
 (define-record-type* <dnsmasq-configuration>
   dnsmasq-configuration make-dnsmasq-configuration
   dnsmasq-configuration?
-  (package          dnsmasq-configuration-package
-                    (default dnsmasq))  ;file-like
+  (package                      dnsmasq-configuration-package
+                                (default dnsmasq))  ;file-like
   (shepherd-provision           dnsmasq-configuration-shepherd-provision
                                 (default '(dnsmasq)))
   (shepherd-requirement         dnsmasq-configuration-shepherd-requirement
                                 (default '(user-processes networking)))
-  (no-hosts?        dnsmasq-configuration-no-hosts?
-                    (default #f))       ;boolean
-  (port             dnsmasq-configuration-port
-                    (default 53))       ;integer
-  (local-service?   dnsmasq-configuration-local-service?
-                    (default #t))       ;boolean
-  (listen-addresses dnsmasq-configuration-listen-address
-                    (default '()))      ;list of string
-  (extra-options    dnsmasq-configuration-extra-options
-                    (default '()))      ;list of string
-  (resolv-file      dnsmasq-configuration-resolv-file
-                    (default "/etc/resolv.conf")) ;string
-  (no-resolv?       dnsmasq-configuration-no-resolv?
-                    (default #f))       ;boolean
+  (pid-file                     dnsmasq-configuration-pid-file
+                                (default "/run/dnsmasq.pid")) ;string
+  (no-hosts?                    dnsmasq-configuration-no-hosts?
+                                (default #f))       ;boolean
+  (port                         dnsmasq-configuration-port
+                                (default 53))       ;integer
+  (local-service?               dnsmasq-configuration-local-service?
+                                (default #t))       ;boolean
+  (listen-addresses             dnsmasq-configuration-listen-address
+                                (default '()))      ;list of string
+  (resolv-file                  dnsmasq-configuration-resolv-file
+                                (default "/etc/resolv.conf")) ;string
+  (no-resolv?                   dnsmasq-configuration-no-resolv?
+                                (default #f))       ;boolean
   (forward-private-reverse-lookup?
-                    dnsmasq-configuration-forward-private-reverse-lookup?
-                    (default #t))       ;boolean
-  (query-servers-in-order?
-                    dnsmasq-configuration-query-servers-in-order?
-                    (default #f))       ;boolean
-  (servers          dnsmasq-configuration-servers
-                    (default '()))      ;list of string
-  (servers-file     dnsmasq-configuration-servers-file
-                    (default #f))       ;string|file-like
-  (addresses        dnsmasq-configuration-addresses
-                    (default '()))      ;list of string
-  (cache-size       dnsmasq-configuration-cache-size
-                    (default 150))      ;integer
-  (negative-cache?  dnsmasq-configuration-negative-cache?
-                    (default #t))       ;boolean
-  (cpe-id           dnsmasq-configuration-cpe-id
-                    (default #f))       ;string
-  (tftp-enable?     dnsmasq-configuration-tftp-enable?
-                    (default #f))       ;boolean
-  (tftp-no-fail?    dnsmasq-configuration-tftp-no-fail?
-                    (default #f))       ;boolean
-  (tftp-single-port? dnsmasq-configuration-tftp-single-port?
-                    (default #f))       ;boolean
-  (tftp-secure?     dnsmasq-tftp-secure?
-                    (default #f))       ;boolean
-  (tftp-max         dnsmasq-tftp-max
-                    (default #f))       ;integer
-  (tftp-mtu         dnsmasq-tftp-mtu
-                    (default #f))       ;integer
-  (tftp-no-blocksize? dnsmasq-tftp-no-blocksize?
-                      (default #f))     ;boolean
-  (tftp-lowercase?  dnsmasq-tftp-lowercase?
-                    (default #f))       ;boolean
-  (tftp-port-range  dnsmasq-tftp-port-range
-                    (default #f))       ;string
-  (tftp-root        dnsmasq-tftp-root
-                    (default "/var/empty,lo")) ;string
-  (tftp-unique-root dnsmasq-tftp-unique-root
-                    (default #f)))      ;"" or "ip" or "mac"
-
+                                dnsmasq-configuration-forward-private-reverse-lookup?
+                                (default #t))       ;boolean
+  (query-servers-in-order?      dnsmasq-configuration-query-servers-in-order?
+                                (default #f))       ;boolean
+  (servers                      dnsmasq-configuration-servers
+                                (default '()))      ;list of string
+  (servers-file                 dnsmasq-configuration-servers-file
+                                (default #f))       ;string|file-like
+  (addresses                    dnsmasq-configuration-addresses
+                                (default '()))      ;list of string
+  (cache-size                   dnsmasq-configuration-cache-size
+                                (default 150))      ;integer
+  (negative-cache?              dnsmasq-configuration-negative-cache?
+                                (default #t))       ;boolean
+  (cpe-id                       dnsmasq-configuration-cpe-id
+                                (default #f))       ;string
+  (tftp-enable?                 dnsmasq-configuration-tftp-enable?
+                                (default #f))       ;boolean
+  (tftp-no-fail?                dnsmasq-configuration-tftp-no-fail?
+                                (default #f))       ;boolean
+  (tftp-single-port?            dnsmasq-configuration-tftp-single-port?
+                                (default #f))       ;boolean
+  (tftp-secure?                 dnsmasq-tftp-secure?
+                                (default #f))       ;boolean
+  (tftp-max                     dnsmasq-tftp-max
+                                (default #f))       ;integer
+  (tftp-mtu                     dnsmasq-tftp-mtu
+                                (default #f))       ;integer
+  (tftp-no-blocksize?           dnsmasq-tftp-no-blocksize?
+                                (default #f))       ;boolean
+  (tftp-lowercase?              dnsmasq-tftp-lowercase?
+                                (default #f))       ;boolean
+  (tftp-port-range              dnsmasq-tftp-port-range
+                                (default #f))       ;string
+  (tftp-root                    dnsmasq-tftp-root
+                                (default "/var/empty,lo")) ;string
+  (tftp-unique-root             dnsmasq-tftp-unique-root
+                                (default #f))       ;"" or "ip" or "mac"
+  (conf-file                    dnsmasq-configuration-conf-file
+                                (default '()))      ;list of string|file-like
+  (conf-dir                     dnsmasq-configuration-conf-dir
+                                (default #f))       ;string|file-like
+  (extra-options                dnsmasq-configuration-extra-options
+                                (default '())))
 (define (dnsmasq-shepherd-service config)
   (match-record config <dnsmasq-configuration>
     (package
      shepherd-provision
      shepherd-requirement
+     pid-file
      no-hosts?
      port local-service? listen-addresses
      resolv-file no-resolv?
@@ -817,7 +854,8 @@ (define (dnsmasq-shepherd-service config)
      tftp-single-port? tftp-secure?
      tftp-max tftp-mtu tftp-no-blocksize?
      tftp-lowercase? tftp-port-range
-     tftp-root tftp-unique-root extra-options)
+     tftp-root tftp-unique-root
+     conf-file conf-dir extra-options)
     (shepherd-service
      (provision shepherd-provision)
      (requirement shepherd-requirement)
@@ -826,7 +864,7 @@ (define (dnsmasq-shepherd-service config)
                (list
                 #$(file-append package "/sbin/dnsmasq")
                 "--keep-in-foreground"
-                "--pid-file=/run/dnsmasq.pid"
+                (string-append "--pid-file=" #$pid-file)
                 #$@(if no-hosts?
                        '("--no-hosts")
                         '())
@@ -897,8 +935,14 @@ (define (dnsmasq-shepherd-service config)
                             (format #f "--tftp-unique-root=~a" tftp-unique-root)
                             (format #f "--tftp-unique-root")))
                        '())
+                #$@(map (lambda (conf-file)
+                          #~(string-append "--conf-file=" #$conf-file))
+                        conf-file)
+                #$@(if conf-dir
+                       (list #~(string-append "--conf-dir=" #$conf-dir))
+                       '())
                 #$@extra-options)
-               #:pid-file "/run/dnsmasq.pid"))
+               #:pid-file #$pid-file))
      (stop #~(make-kill-destructor)))))
 
 (define (dnsmasq-activation config)
-- 
2.48.1





Message sent to ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#77204] [PATCH 3/3] services: dnsmasq: Provide stats and reload actions.
Resent-From: Alexey Abramov <levenson@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: ludo@HIDDEN, maxim.cournoyer@HIDDEN, guix-patches@HIDDEN
Resent-Date: Sun, 23 Mar 2025 10:29:05 +0000
Resent-Message-ID: <handler.77204.B77204.174272570024092 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77204
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 77204 <at> debbugs.gnu.org
Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Received: via spool by 77204-submit <at> debbugs.gnu.org id=B77204.174272570024092
          (code B ref 77204); Sun, 23 Mar 2025 10:29:05 +0000
Received: (at 77204) by debbugs.gnu.org; 23 Mar 2025 10:28:20 +0000
Received: from localhost ([127.0.0.1]:47818 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1twIZ1-0006GN-HB
	for submit <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:20 -0400
Received: from mail.mmer.org ([178.22.65.174]:52648)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <levenson@HIDDEN>) id 1twIYq-0006Dx-1U
 for 77204 <at> debbugs.gnu.org; Sun, 23 Mar 2025 06:28:12 -0400
Received: from mail.mmer.org (localhost [127.0.0.1])
 by mail.mmer.org (OpenSMTPD) with ESMTP id a7476dc5
 for <77204 <at> debbugs.gnu.org>; Sun, 23 Mar 2025 10:27:55 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=9QW5hBEOsyjJQR9wIafBpV6R6
 VdGlnwwVOxlf+Sk1R8=; b=N5HqafytSVTXIsB+n30okupWVcn8tyUeNxP14PYfC
 QQQpAb+tC6azCP5JTWY+yMDBtYiWwFy12vdFb1ReJpHmbxpXv65Y7xWfglh9rPKE
 VXJy/p+l8q4fRg9SoWqeFFSBnxTnAGOYpbrlnN9rW5uGTjhbj73s98nk/SC8bFfj
 yQ=
Received: from delta (16-254-250-62.ftth.glasoperator.nl [62.250.254.16])
 by mail.mmer.org (OpenSMTPD) with ESMTPSA id ec96279c
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <77204 <at> debbugs.gnu.org>;
 Sun, 23 Mar 2025 10:27:54 +0000 (UTC)
From: Alexey Abramov <levenson@HIDDEN>
Date: Sun, 23 Mar 2025 11:27:52 +0100
Message-ID: <2769b5461f5882a9429042aa5650ba1a982fdfff.1742725327.git.levenson@HIDDEN>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <cover.1742725327.git.levenson@HIDDEN>
References: <cover.1742725327.git.levenson@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/services/dns.scm (dnsmasq-service-reload-action)
(dnsmasq-service-stats-action): New functions.
* doc/guix.texi: Document the change.
* gnu/tests/networking.scm: Add tests.
---
 doc/guix.texi            | 10 ++++
 gnu/services/dns.scm     | 22 +++++++++
 gnu/tests/networking.scm | 98 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 130 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index a6996e30358..1583ad36c89 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -35165,6 +35165,16 @@ DNS Services
 @end lisp
 @end defvar
 
+@code{dnsmasq-service-type} also provides few helpful actions which are
+@code{reload} and @code{stats}.  For example:
+
+@example
+herd stats dnsmasq
+@end example
+
+Will ask @command{dnsmasq} service to dump its statistics to the system log, which
+is usually @file{/var/log/messages}.
+
 @deftp {Data Type} dnsmasq-configuration
 Data type representing the configuration of dnsmasq.
 
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 6e2ec7c2067..a091dbfb86c 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -860,6 +860,8 @@ (define (dnsmasq-shepherd-service config)
      (provision shepherd-provision)
      (requirement shepherd-requirement)
      (documentation "Run the dnsmasq DNS server.")
+     (actions (list (dnsmasq-service-reload-action config)
+                    (dnsmasq-service-stats-action config)))
      (start #~(make-forkexec-constructor
                (list
                 #$(file-append package "/sbin/dnsmasq")
@@ -951,6 +953,26 @@ (define (dnsmasq-activation config)
       ;; create directory to store dnsmasq lease file
       (mkdir-p "/var/lib/misc")))
 
+(define (dnsmasq-service-reload-action config)
+  (match-record config <dnsmasq-configuration> ()
+    (shepherd-action
+     (name 'reload)
+     (documentation "Send a SIGHUP signal to re-load /etc/hosts and /etc/ethers and any
+file given by --dhcp-hostsfile, --dhcp-hostsdir, --dhcp-optsfile, --dhcp-optsdir,
+--addn-hosts or --hostsdir.  SIGHUP does NOT re-read the configuration file.")
+     (procedure #~(lambda (running)
+                    (let ((pid (process-id running)))
+                      (kill pid SIGHUP)))))))
+
+(define (dnsmasq-service-stats-action config)
+  (match-record config <dnsmasq-configuration> ()
+    (shepherd-action
+     (name 'stats)
+     (documentation "Send a SIGUSR1 to write statistics to the system log.")
+     (procedure #~(lambda (running)
+                    (let ((pid (process-id running)))
+                      (kill pid SIGUSR1)))))))
+
 (define dnsmasq-service-type
   (service-type
    (name 'dnsmasq)
diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm
index 7d54ebba50e..fdc515ceb04 100644
--- a/gnu/tests/networking.scm
+++ b/gnu/tests/networking.scm
@@ -27,6 +27,7 @@ (define-module (gnu tests networking)
   #:use-module (gnu system vm)
   #:use-module (gnu services)
   #:use-module (gnu services base)
+  #:use-module (gnu services dns)
   #:use-module (gnu services networking)
   #:use-module (guix gexp)
   #:use-module (guix store)
@@ -46,6 +47,7 @@ (define-module (gnu tests networking)
             %test-openvswitch
             %test-dhcpd
             %test-dhcpcd
+            %test-dnsmasq
             %test-tor
             %test-iptables
             %test-ipfs))
@@ -675,6 +677,102 @@ (define %test-dhcpd
    (description "Test a running DHCP daemon configuration.")
    (value (run-dhcpd-test))))
 
+
+
+;;;
+;;; dnsmasq tests
+;;;
+
+
+(define dnsmasq-os-configuration
+  (dnsmasq-configuration))
+
+(define %dnsmasq-os
+  (simple-operating-system
+   (service dhcp-client-service-type)
+   (service dnsmasq-service-type
+            (dnsmasq-configuration
+             (extra-options
+              (list "--log-facility=/tmp/dnsmasq.log"))))))
+
+
+(define (run-dnsmasq-test)
+  (define os
+    (marionette-operating-system %dnsmasq-os
+                                 #:imported-modules '((gnu services herd))))
+
+  (define test
+    (with-imported-modules '((gnu build marionette))
+      #~(begin
+          (use-modules (gnu build marionette)
+                       (srfi srfi-64))
+
+          (define marionette
+            (make-marionette (list #$(virtual-machine os))))
+
+          (test-runner-current (system-test-runner #$output))
+          (test-begin "dnsmasq")
+
+          (test-assert "dnsmasq is alive"
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (wait-for-service 'dnsmasq))
+             marionette))
+
+          (test-assert "pid file exists"
+            (wait-for-file
+             '#$(dnsmasq-configuration-pid-file dnsmasq-os-configuration)
+             marionette))
+
+          (test-assert "send SIGHUP"
+            (positive?
+             (marionette-eval
+              '(begin
+                 (use-modules (ice-9 rdelim))
+                 (system* "sync")
+                 (let* ((port (open-input-file "/tmp/dnsmasq.log")))
+                   (seek port 0 SEEK_END)
+                   (system* "herd" "reload" "dnsmasq")
+                   (system* "sync")
+                   (let ((line (read-line port)))
+                     (close-port port)
+                     (string-contains line "read /etc/hosts"))))
+              marionette)))
+
+          (test-assert "send SIGUSR1"
+            (positive?
+             (marionette-eval
+              '(begin
+                 (use-modules (ice-9 rdelim))
+                 (system* "sync")
+                 (let* ((port (open-input-file "/tmp/dnsmasq.log")))
+                   (seek port 0 SEEK_END)
+                   (system* "herd" "stats" "dnsmasq")
+                   (system* "sync")
+                   (let ((line (read-line port)))
+                     (close-port port)
+                     (string-contains-ci line "time"))))
+              marionette)))
+
+          (test-assert "dnsmasq is alive"
+            (marionette-eval
+             '(begin
+                (use-modules (gnu services herd))
+                (wait-for-service 'dnsmasq))
+             marionette))
+
+          (test-end))))
+
+  (gexp->derivation "dnsmasq-test" test))
+
+(define %test-dnsmasq
+  (system-test
+   (name "dnsmasq")
+   (description "Test a running dnsmasq daemon configuration.")
+   (value (run-dnsmasq-test))))
+
+
 
 ;;;
 ;;; DHCPCD Daemon
-- 
2.48.1






Last modified: Sun, 23 Mar 2025 10:30:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.