From patchwork Tue Apr 11 07:33:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 49084 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 92DA11748D; Tue, 11 Apr 2023 08:35:14 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 EFD4D172BD for ; Tue, 11 Apr 2023 08:35:11 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pm8Wv-00028P-Qw; Tue, 11 Apr 2023 03:35:05 -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 1pm8Ws-00027W-Nx for guix-patches@gnu.org; Tue, 11 Apr 2023 03:35:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pm8Ws-0005Bg-9W for guix-patches@gnu.org; Tue, 11 Apr 2023 03:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pm8Wr-0000RJ-Qz for guix-patches@gnu.org; Tue, 11 Apr 2023 03:35:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62770] [PATCH] services: dhcp-client-configuration: Add 'shepherd-requirement' field. Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 11 Apr 2023 07:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62770 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62770@debbugs.gnu.org Cc: Sergey Trofimov X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16811984591637 (code B ref -1); Tue, 11 Apr 2023 07:35:01 +0000 Received: (at submit) by debbugs.gnu.org; 11 Apr 2023 07:34:19 +0000 Received: from localhost ([127.0.0.1]:36520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm8WB-0000QK-BC for submit@debbugs.gnu.org; Tue, 11 Apr 2023 03:34:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:59882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pm8W8-0000QC-VL for submit@debbugs.gnu.org; Tue, 11 Apr 2023 03:34:17 -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 1pm8W8-00022R-JD for guix-patches@gnu.org; Tue, 11 Apr 2023 03:34:16 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pm8W5-00057l-R1 for guix-patches@gnu.org; Tue, 11 Apr 2023 03:34:15 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-50489acccdfso1726639a12.1 for ; Tue, 11 Apr 2023 00:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1681198450; x=1683790450; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PQQ+Qpk7Izjc93OjfK96zBqMMHAmjHi5a3USV97opUU=; b=SDj6eLW755Klselvx+YfOkQCMOryB9YzFFugdGYsUjHuiGnAQNlSCAGT4A2d2ftzoi nXAoMnK0GXnZMPmDgXnaVA3h3B9jWdlQ8dPekb8JzrNAwNT1H4H/Qj2I7ejodDFAtIxe fZJa4rkfnfgucZ1ctT24b4syBqAAP83Sp7oZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681198450; x=1683790450; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PQQ+Qpk7Izjc93OjfK96zBqMMHAmjHi5a3USV97opUU=; b=x90nPWuk7zylkb1k25oM2qWVdZ+a65jos16W1kW23lqvpymXcs3TgGeC3wIfc2mIrM ZLTVc6oyaWy4q64wbeO9iFaj2QQkIxEPCW55MujwAyPJlsWnXqWo3xuN/FM1ZGtT9QS9 kzhGwPgnO3hbJE1zd35jqY2Lwvo8L3Ary7BMbZKEFZmMokbEtAL+sWvsKbdLxO85Nb0L d2cqdBLlrq6xtxdV0IX7ZWiUtkmwMlh+vhATDagATcpmiHlN/coytIqdKQdcvg6PdmGA ygyBF9MUJ5AA+nyxhksElXJ0nt4Cx1GkmMpdoB07IDPv0i3QtIMyeSPUt/p4H9b5QIYu 9H9Q== X-Gm-Message-State: AAQBX9eHppFeGVvlKqYryo7EeE4ztz33WF3xOcb7qMKIXVho1U/fCN6E jQvgjX9yWiOIT76Mj5mMePOErdEDW9fo0/UB87Tdng== X-Google-Smtp-Source: AKy350Y/iF/x0zcaSPo7Oa0CJBRPQJ6nhqpBWDspGpd4YJS+Dlbswag3scDuYfA4r6VmwWJZFSjVwg== X-Received: by 2002:a05:6402:643:b0:4fb:98e2:3df8 with SMTP id u3-20020a056402064300b004fb98e23df8mr11905108edx.27.1681198449670; Tue, 11 Apr 2023 00:34:09 -0700 (PDT) Received: from localhost ([95.168.154.15]) by smtp.gmail.com with ESMTPSA id f6-20020a50d546000000b00501d39f1d2dsm5609191edj.41.2023.04.11.00.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 00:34:09 -0700 (PDT) From: Sergey Trofimov Date: Tue, 11 Apr 2023 09:33:57 +0200 Message-Id: <20230411073357.30021-1-sarg@sarg.org.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: none client-ip=2a00:1450:4864:20::52b; envelope-from=sarg@sarg.org.ru; helo=mail-ed1-x52b.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 () [shepherd-requirement]: New field. (dhcp-client-shepherd-service): Honor it. (dhcp-client-configuration-shepherd-requirement): Export accessor. * doc/guix.texi (Networking Setup): Document it. --- doc/guix.texi | 8 +++++++- gnu/services/networking.scm | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ac60acf98c..25f06fd0a8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19892,6 +19892,12 @@ should listen on---e.g., @code{'("eno1")}. When set to @code{'all}, the DHCP client listens on all the available non-loopback interfaces that can be activated. Otherwise the DHCP client listens only on the specified interfaces. + +@item @code{shepherd-requirement} (default: @code{'()}) +This option can be used to provide a list of symbols naming Shepherd services +that this service will depend on, such as @code{'wpa-supplicant} or +@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet +networks. @end table @end deftp @@ -19995,7 +20001,7 @@ Data Type representing the configuration of connman. @item @code{connman} (default: @var{connman}) The connman package to use. -@item @code{shepherd-requirement} (default: @code{()}) +@item @code{shepherd-requirement} (default: @code{'()}) This option can be used to provide a list of symbols naming Shepherd services that this service will depend on, such as @code{'wpa-supplicant} or @code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 19c109d238..1b2e6a8c53 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -89,6 +89,7 @@ (define-module (gnu services networking) dhcp-client-configuration? dhcp-client-configuration-package dhcp-client-configuration-interfaces + dhcp-client-configuration-shepherd-requirement dhcpd-service-type dhcpd-configuration @@ -279,6 +280,8 @@ (define-record-type* dhcp-client-configuration? (package dhcp-client-configuration-package ;file-like (default isc-dhcp)) + (shepherd-requirement dhcp-client-configuration-shepherd-requirement + (default '())) (interfaces dhcp-client-configuration-interfaces (default 'all))) ;'all | list of strings @@ -286,11 +289,12 @@ (define dhcp-client-shepherd-service (match-lambda ((? dhcp-client-configuration? config) (let ((package (dhcp-client-configuration-package config)) + (shepherd-requirement (dhcp-client-configuration-shepherd-requirement config)) (interfaces (dhcp-client-configuration-interfaces config)) (pid-file "/var/run/dhclient.pid")) (list (shepherd-service (documentation "Set up networking via DHCP.") - (requirement '(user-processes udev)) + (requirement `(user-processes udev ,@shepherd-requirement)) ;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when ;; networking is unavailable, but also means that the interface is not up