From patchwork Fri May 23 09:04:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 42880 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 88A5227BC4C; Fri, 23 May 2025 10:05:29 +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=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 E87F327BC4D for ; Fri, 23 May 2025 10:05:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uIOKz-0007kE-ED; Fri, 23 May 2025 05:05: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 1uIOKx-0007jl-FV for guix-patches@gnu.org; Fri, 23 May 2025 05:05:07 -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 1uIOKw-0000xh-EQ; Fri, 23 May 2025 05:05:06 -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=h+w7mKX9W/tj0Bge6xsekkSIHExarjRSbiNkFaCADrqInIHS+gXq+U2wy96KMIxVernccqxEMw+6iXTJseSQ3loxLjqJgEiWfxXspwTVf0syKfDJuND4Dc81NpefmZCHzVPvc1m81JGxKy37s52bBCHJ/wIXLVml5nqWNe9BMpGjv6wswMcL6dmIBcCQUri/NsHulmEDaf+MpD27Ag/3FvnnLhmPa1I3ypSGsGy4eRWL744fsTQxLl1nCZrNCD/IRaICmNwg//c5DoefTOMYENANCYI48cyOcZ+qw7ML3eKK7Ung5Cl8ganwtMg/x+ziOWKmxF8NMkx3SGLFQcVwiw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uIOKt-0006j6-Aw; Fri, 23 May 2025 05:05:03 -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: sarg@sarg.org.ru, gabriel@erlikon.ch, ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 23 May 2025 09:05:03 +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 , Sergey Trofimov , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Sergey Trofimov , Gabriel Wicki , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 78546-submit@debbugs.gnu.org id=B78546.174799109525820 (code B ref 78546); Fri, 23 May 2025 09:05:03 +0000 Received: (at 78546) by debbugs.gnu.org; 23 May 2025 09:04:55 +0000 Received: from localhost ([127.0.0.1]:45524 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uIOKk-0006i7-Et for submit@debbugs.gnu.org; Fri, 23 May 2025 05:04:55 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:44181) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uIOKg-0006hM-LZ for 78546@debbugs.gnu.org; Fri, 23 May 2025 05:04:51 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-60119cd50b6so11893644a12.0 for <78546@debbugs.gnu.org>; Fri, 23 May 2025 02:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1747991084; x=1748595884; 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=Gmxg+QskL0aoY/UOaXXpPooEykos7OMABblH4GlUDMqFoGxwfu3y7S1j2UtYjcuE9x HrAO8LvXVevf6tBVnKij/ac8i6boftWwk3AzsIAmxXq7t8XazRm4sVK9mG/sIQ72LVJo IN+Fh6lj0Z+V6q8DD3Nq2kkpQ1ztXUiVn7cxYlr1p/zx5sbwC7mMvESbtoIYaz8PMhvd c8TnTsaRCqNkvlxgLnX7cCuyEJyEbyJTCVGqgFa6P3yMarsAP0Ur/qgO2uDj3/dpWEAJ wQ0UxCn3wZtVx5GGi4xRmFfB14qdDi6GSuRjlhdauQflq6Z7XHZiepyU8sqNbf6pyU26 XHJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747991084; x=1748595884; 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=qPrIG78GPjZy9xR9BmNM3PubAQfTTE8It+iz11JbmHUPC9PueyxQvkCS/Ik4NxAE0+ cd8lFwounH04qNFrKMdnoyfZ/1W4FieaGvvXVgzxfsxy9FBGNKzeNcZ8ObTEZLoAeuBD 2iMKIW/NPOEY+nSjnMrpLAiQAAX92pW1anZdmLEE+tbJzVvJWqLxFA68kdO1CW4FQq86 2vmvRgIOntCXEjiNVi470daFmrYpEvIpXG4hh1JCnc7CRs0ahdjF6G4VdEQ+gH6eTqbg YimGHTWjbof4Z7VvnOKSMmT3jTbTnIz9Rva1Nu23ZT/Haq0z3jR+v0JiL3MO91u/ysYS lIRQ== X-Gm-Message-State: AOJu0YwoBedrySTNiU43zQExfVyPM+I1BHNnOj3su5hrLH5HohfDhSaZ xWmxlOnIXFp+njWUmpyiYb0IajpMxVIeIuFjDmI2VtGUFMkPSKDhfWdm27m086t48M2tugj7eHg pAirDdk0= X-Gm-Gg: ASbGncuF3N5rhFeh381AIJdtvtz6MFBH1ds3317mAIGG8g3MxIXHssJXvNgATRod4Ad nnRJ4F7Gkv+aggZIhzxD+96/DhmI/Ixv0P5tZuPCQn08ctdP4LmQrX3Dmb07wLlGz/0JgBZxIC5 T8hmjcfYznmm3PKhH8sBE8spPeWENFYO5O25ykqjPg0HFLV96A3dmg/yOZGm0N+NqVM0ewCHBvm xklwPsz/YJLegFyJ2NX3K6zxRhtjSyI32aPdDJwXahxNm3LD6IrqN2eszMVDQWNULZFKyPbgxGQ QRYANtOZKddaCWRqcu6eHstMNMvWVK37Ms/8sDZPawo/hD/vAQ== X-Google-Smtp-Source: AGHT+IHjUzzKqoWpGztqbQDamXSPdC+RWUuyfv6UkJcZEXCcs+kDJDrIVwneHtE2kZiqYdTHxuNkGA== X-Received: by 2002:a05:6402:2108:b0:5fa:b131:f009 with SMTP id 4fb4d7f45d1cf-6007e825a98mr24623684a12.0.1747991084036; Fri, 23 May 2025 02:04:44 -0700 (PDT) Received: from localhost ([2a02:2454:a095:5600:a64e:31ff:fe38:fd6c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6005ae3b824sm11675844a12.79.2025.05.23.02.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 May 2025 02:04:43 -0700 (PDT) From: Sergey Trofimov Date: Fri, 23 May 2025 11:04:33 +0200 Message-ID: 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)