From patchwork Thu May 22 11:32:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 42860 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E5FA27BC4A; Thu, 22 May 2025 12:35:34 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6DFDD27BC4C for ; Thu, 22 May 2025 12:35:32 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uI4Cb-0000SG-JR; Thu, 22 May 2025 07:35:09 -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 ) id 1uI4CW-0000KN-SJ for guix-patches@gnu.org; Thu, 22 May 2025 07:35:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uI4CV-0008US-JD; Thu, 22 May 2025 07:35:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=; b=NHm9+a9Hvq1+KJeYJ3ewtqB4fXeD1eslZKD6uzI4GuFGehynozFJ+EKpK4Q26nxGSoUS2lnURfkrP2WuPMzFr/6K5kO+P/M6SBCXj0KnOOUyseX12uPjkq2f2E82k65Bl6/lQlo0QHO54XIQ0XqZOC/QllNXm2R1cX7uWbKM8xRsuNtDfmkjDRBj2tDV2imTIP8ciUbOZ3MbQnUPV4G7wVTvzscI5cwpoXoyCG9amQ4/oz5nHKhUFdCj7OVrf9iGbDYriAeMZa0K8FdZGRpVCjwld3DoYIQ+++bde5rgMLf00qSQ36IYpgnzMzxsn/0lNCGjk4QcJlDZebbHJIYF7A==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uI4CU-0006P1-Fy; Thu, 22 May 2025 07:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78546] [PATCH 2/3] services: networking: Add shepherd-requirement for dhcpcd. Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: gabriel@erlikon.ch, ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Thu, 22 May 2025 11:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 78546 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78546@debbugs.gnu.org Cc: Sergey Trofimov , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 78546-submit@debbugs.gnu.org id=B78546.174791368624516 (code B ref 78546); Thu, 22 May 2025 11:35:02 +0000 Received: (at 78546) by debbugs.gnu.org; 22 May 2025 11:34:46 +0000 Received: from localhost ([127.0.0.1]:32819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uI4CD-0006ND-GB for submit@debbugs.gnu.org; Thu, 22 May 2025 07:34:46 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:51345) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uI4C7-0006Lt-JC for 78546@debbugs.gnu.org; Thu, 22 May 2025 07:34:40 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-601fb2b7884so7289879a12.2 for <78546@debbugs.gnu.org>; Thu, 22 May 2025 04:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747913672; x=1748518472; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=; b=cRZPO+OnJwrkA8Jld5XtGAN+OwjdrZIz9WJRsibPuaclJiYSulIlsZjBSnT/1yWUqH IuoGIp+T1tpQG7a3dM9QIVs5hhh8hU5KlbY7hMvnyw6hSrne6jPfsM8LZJOEwSvV1NVI vOxrFS+ohMn4LqAusDGZ0NqHxd/PsMt5NT5k1LUs3bIdIt5WOlHnixH32z7T3oeBWdb5 xKxnzy0aog3j67jmB3BmEvGqEkc4oKSX4zUwEbcn4OfXbdZx4mjtFfSlOCJ10Ue1jx0+ KXd3RIEETITitj+BbTdpvsWC9RoxggI1fMlXOZbA3VFTz5HrgPyq2H15E6eJE8VtFV4i TXlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747913672; x=1748518472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Funi3tuZKoaYxgLo+kP2aQUe/2aPhnrBGoCo/as63Y=; b=nVf0pYOq4b+QCSj7t67sQa06p/erh6vqQIIdZdLUWrLYZGBtx7Le56IBax62IVz7F6 lZJPd50WmNCPjnif0EzSPQbB5iRZAUXs6LDIkOVz28Q+13PGYVZYFZhmTEH4P3WMidIR F2BcWWkM4zKusDO4gpZJUsiBbfh7KAs4ZOtB8IZC3fJ4MOlyyU83O7lYiEqYVGB9pK3f 6tKFZxS13YlKH9dfj2tYZvfNBj2OluRojpfgv6onOlw6h3oCsKE8XGPeovSmL/EdUm/5 TL8mix4ysW5m7HMvI8zmwHoKkwRPgfZB3DFk8T0EyD70JBxI4wfqzC0Va5sXjeMplLrT ms0g== X-Gm-Message-State: AOJu0YxkTcspDE5EiowQVSCfY313xmDFfwLFbVqUs3K+och/5BrP/lQc j21ulAtiyhSOJHFsH6/PeOxjYihxkAlniBNvFhB7KFTEIlagwRN7yRMujl87PfGJJ2f+lRHHLi3 qwAXUd5k= X-Gm-Gg: ASbGnct7ZmALRNidyLmB8cTqGaXkevyB0/9vviNAtwAk9m8uP1a8LkuBw65tfjp5eLX 1ebSh8vRuIdCIhoVbx9Dp0/oo25TzslkBdZtEKxH16jRnquSeX3L/dqdGPalzDhYQHJkvvUIBEF fWvsXG6LieQnLnOgODnv7mrj2NCPcCvY40r+XB2eIEVr+TYCQtaMo4YCZa0bX5CrtNMfj4j4nC+ bEx5UZpZ4tgNN1k4r3vKrFMd2TGdFWXDKGmQq+xd81siJzQqZYEKL8D1bLovQj7PmMuxwzhfvUo MN55MfHQbZYhoD2z4lMaD5QqpRr8bvKJLm4euLHS5u+8SgkURw== X-Google-Smtp-Source: AGHT+IFBkFes/v60TbIwY9ixw/sfWFEQns0lbwYgFo7EK+6wJWli8OJSmktyFETZFESJucv3x/oGCg== X-Received: by 2002:a05:6402:1ed0:b0:602:10b6:c982 with SMTP id 4fb4d7f45d1cf-60210b6cf68mr9166667a12.12.1747913672301; Thu, 22 May 2025 04:34:32 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a6fe:ab0a:f6f7:9028]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6005ac336d5sm10472238a12.54.2025.05.22.04.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 May 2025 04:34:31 -0700 (PDT) From: Sergey Trofimov Date: Thu, 22 May 2025 13:32:56 +0200 Message-ID: <2a43bbb6ead770a9302fe5d7d979dda6e87dcc64.1747912984.git.sarg@sarg.org.ru> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/networking.scm (dhcpcd-configuration): Add shepherd-requirement field. (dhcpcd-shepherd-service): Use it. * doc/guix.texi (Networking Setup): Regenerate dhcpcd-configuration documentation. (File Systems): Fix typo. Change-Id: Id347e2bed2569237685a47be82dbf686640db25b --- doc/guix.texi | 17 +++++++++++------ gnu/services/networking.scm | 31 +++++++++++++++++++------------ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 02f472246a..3ef2e50e57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18332,7 +18332,7 @@ File Systems might not be sufficient as @code{networking} being marked as started does @emph{not} imply the network has already been configured and in working order (for example, when using -@code{dhcpcd-client-service-type}). For such cases, adding a +@code{dhcp-client-service-type}). For such cases, adding a requirement on a custom @code{network-online} service may be necessary. A sample @code{network-online} one-shot Shepherd service implementation is provided below: @@ -21980,12 +21980,13 @@ Networking Setup @item @code{duid} (default: @code{""}) (type: maybe-string) DHCPv4 clients require a unique client identifier, this option uses the DHCPv6 Unique Identifier as a DHCPv4 client identifier as well. For -more information, refer to @uref{https://www.rfc-editor.org/rfc/rfc4361, RFC 4361} -and @code{dhcpcd.conf(5)}. +more information, refer to +@uref{https://www.rfc-editor.org/rfc/rfc4361,RFC 4361} and +@code{dhcpcd.conf(5)}. @item @code{persistent?} (default: @code{#t}) (type: boolean) -When true, automatically de-configure the interface when @command{dhcpcd} -exits. +When true, automatically de-configure the interface when +@command{dhcpcd} exits. @item @code{option} (default: @code{("rapid_commit" "domain_name_servers" "domain_name" "domain_search" "host_name" "classless_static_routes" "interface_mtu")}) (type: list-of-strings) List of options to request from the server. @@ -22019,9 +22020,13 @@ Networking Setup @item @code{extra-content} (type: maybe-string) Extra content to append to the configuration as-is. +@item @code{shepherd-requirement} (default: @code{()}) (type: list-of-symbols) +This is a list of symbols naming Shepherd services that this service +will depend on. + @end table -@end deftp +@end deftp @cindex NetworkManager diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 67653e2cbf..4cb7313808 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -126,6 +126,7 @@ (define-module (gnu services networking) dhcpcd-configuration-vendor-class-id dhcpcd-configuration-client-id dhcpcd-configuration-extra-content + dhcpcd-configuration-shepherd-requirement ntp-configuration ntp-configuration? @@ -609,6 +610,12 @@ (define-configuration dhcpcd-configuration maybe-string "Extra content to append to the configuration as-is.") + (shepherd-requirement + (list-of-symbols '()) + "This is a list of symbols naming Shepherd services that this service +will depend on." + empty-serializer) + (prefix dhcpcd-)) (define (dhcpcd-config-file config) @@ -628,19 +635,19 @@ (define dhcpcd-account-service (shell (file-append shadow "/sbin/nologin"))))) (define (dhcpcd-shepherd-service config) - (let* ((config-file (dhcpcd-config-file config)) - (command-args (dhcpcd-configuration-command-arguments config)) - (ifaces (dhcpcd-configuration-interfaces config))) - (list (shepherd-service - (documentation "dhcpcd daemon.") - (provision '(networking)) - (requirement '(user-processes udev)) - (actions (list (shepherd-configuration-action config-file))) - (start + (match-record config + (command-arguments interfaces shepherd-requirement) + (let ((config-file (dhcpcd-config-file config))) + (list (shepherd-service + (documentation "dhcpcd daemon.") + (provision '(networking)) + (requirement `(user-processes udev ,@shepherd-requirement)) + (actions (list (shepherd-configuration-action config-file))) + (start #~(make-forkexec-constructor - (list (string-append #$dhcpcd "/sbin/dhcpcd") - #$@command-args "-B" "-f" #$config-file #$@ifaces))) - (stop #~(make-kill-destructor)))))) + (list (string-append #$dhcpcd "/sbin/dhcpcd") + #$@command-arguments "-B" "-f" #$config-file #$@interfaces))) + (stop #~(make-kill-destructor))))))) (define dhcpcd-service-type (service-type (name 'dhcpcd)