From patchwork Wed Oct 5 22:04:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 43168 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 16A9727BBEA; Wed, 5 Oct 2022 23:06:30 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 7735127BBE9 for ; Wed, 5 Oct 2022 23:06:29 +0100 (BST) Received: from localhost ([::1]:56938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogCX5-00072z-E1 for patchwork@mira.cbaines.net; Wed, 05 Oct 2022 18:06:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogCWk-00072c-Lf for guix-patches@gnu.org; Wed, 05 Oct 2022 18:06:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogCWg-0004RG-59 for guix-patches@gnu.org; Wed, 05 Oct 2022 18:06:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ogCWf-0007Zz-Qe for guix-patches@gnu.org; Wed, 05 Oct 2022 18:06:01 -0400 Subject: bug#58223: [PATCH 0/1] dhclient record configuration Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Wed, 05 Oct 2022 22:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 58223 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Alexey Abramov Cc: 58223-done@debbugs.gnu.org Mail-Followup-To: 58223@debbugs.gnu.org, ludo@gnu.org, levenson@mmer.org Received: via spool by 58223-done@debbugs.gnu.org id=D58223.166500750529064 (code D ref 58223); Wed, 05 Oct 2022 22:06:01 +0000 Received: (at 58223-done) by debbugs.gnu.org; 5 Oct 2022 22:05:05 +0000 Received: from localhost ([127.0.0.1]:58270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogCVk-0007Yh-NN for submit@debbugs.gnu.org; Wed, 05 Oct 2022 18:05:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogCVh-0007Y7-Lb for 58223-done@debbugs.gnu.org; Wed, 05 Oct 2022 18:05:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:45608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogCVc-000498-D4; Wed, 05 Oct 2022 18:04:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=cGrCAi6K9aSaJMh512ubSqNsN4HVjdQYohya/iA2xfA=; b=e/dj98b/ErqI069bTzu6 fA2ewS0CNaTQJJjldkiZmnWaR5Ps9EFDh8e0QNDcgLbyJeYWJINBMpaFSFT7dtnhoJc4jZfZMK1Px PrSV34hAK8btN/AJlVokZUK1KLDt4+cIifTx/M5UEMZHNpbMgWz3VBSTKxpyGy+8QWFSdRdWJvcXY uQvAlOQms6c4Dn2d+JQn+JszlA8OYQ/3rFrvINcsvFmNh0t/dLd9HgYLcHPgvpAnTbx/TrqZCQI/r WColpwulK1Md7npqD0EsxecDtfQhm73RR1k7aFD560YQM/D01e/7+Wpq8k9FLyD7BCHREnb5a9YyL 1Z+0g1FsdMAhOw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:65059 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogCVb-0004T6-RY; Wed, 05 Oct 2022 18:04:56 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= References: <20221001131112.2649-1-levenson@mmer.org> <20221001131257.3407-1-levenson@mmer.org> Date: Thu, 06 Oct 2022 00:04:53 +0200 In-Reply-To: <20221001131257.3407-1-levenson@mmer.org> (Alexey Abramov's message of "Sat, 1 Oct 2022 15:12:57 +0200") Message-ID: <87edvmorju.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) 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" X-getmail-retrieved-from-mailbox: Patches Hi, Alexey Abramov skribis: > * gnu/services/networking.scm (dhcp-client-configuration): New record > configuration. > (dhcp-client-shepherd-service): Implement a shepher service. Provide a > deprication message for legacy configurations. > (dhcp-client-service-type): Use dhcp-client-shepherd-service. > * doc/guix.texi: Update documentation [...] > + ;; Empty list (means any) or a list of valid interfaces > + (interfaces dhcp-client-configuration-interfaces > + (default '()))) [...] > + (define ifaces > + (filter valid? (or '#$interfaces > + (all-network-interface-names)))) This isn’t quite right since '() is always true. For this and for aesthetic reasons, I changed ‘interfaces’ such that it must be either 'all or a list. Applied with the changes below, thanks! Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index afc18239d4..6691ae5844 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19234,17 +19234,19 @@ Protocol (DHCP) client. @end defvr @deftp {Data Type} dhcp-client-configuration -Data type representing the configuration of dhcp client network service. +Data type representing the configuration of the DHCP client service. @table @asis @item @code{package} (default: @code{isc-dhcp}) DHCP client package to use. -@item @code{interfaces} (default: @code{'()}) -List of strings of interface names that dhcp client should listen on. By -default dhcp client will listen on all available non-loopback interfaces -that can be activated (meaning, to set them up). (default: @code{'()}) +@item @code{interfaces} (default: @code{'all}) +Either @code{'all} or the list of interface names that the DHCP client +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. @end table @end deftp diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 1185f7e57d..19aba8c266 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -66,6 +66,9 @@ (define-module (gnu services networking) #:use-module (guix modules) #:use-module (guix packages) #:use-module (guix deprecation) + #:use-module (guix diagnostics) + #:autoload (guix ui) (display-hint) + #:use-module (guix i18n) #:use-module (rnrs enums) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -269,9 +272,8 @@ (define-record-type* dhcp-client-configuration? (package dhcp-client-configuration-package ;file-like (default isc-dhcp)) - ;; Empty list (means any) or a list of valid interfaces (interfaces dhcp-client-configuration-interfaces - (default '()))) + (default 'all))) ;'all | list of strings (define dhcp-client-shepherd-service (match-lambda @@ -305,8 +307,12 @@ (define valid? (false-if-exception (set-network-interface-up interface))))) (define ifaces - (filter valid? (or '#$interfaces - (all-network-interface-names)))) + (filter valid? + #$(match interfaces + ('all + #~(all-network-interface-names)) + (_ + #~'#$interfaces)))) (false-if-exception (delete-file #$pid-file)) (let ((pid (fork+exec-command @@ -315,18 +321,21 @@ (define ifaces (and (zero? (cdr (waitpid pid))) (read-pid-file #$pid-file))))) (stop #~(make-kill-destructor)))))) - (anything - (format (current-error-port) "warning: Defining dhcp-client service with -a single argument value being a client package to use, is deprecated. Please -use record instead.\n") + (package + (warning (G_ "'dhcp-client' service now expects a \ +'dhcp-client-configuration' record~%")) + (display-hint (G_ "The value associated with instances of +@code{dhcp-client-service-type} must now be a @code{dhcp-client-configuration} +record instead of a package. Please adjust your configuration accordingly.")) (dhcp-client-shepherd-service (dhcp-client-configuration - (package anything)))))) + (package package)))))) (define dhcp-client-service-type (service-type (name 'dhcp-client) (extensions - (list (service-extension shepherd-root-service-type dhcp-client-shepherd-service))) + (list (service-extension shepherd-root-service-type + dhcp-client-shepherd-service))) (default-value (dhcp-client-configuration)) (description "Run @command{dhcp}, a Dynamic Host Configuration Protocol (DHCP) client, on all the non-loopback network interfaces."))) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 4050a4c7ae..ed3fdb6be0 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -5,6 +5,7 @@ gnu/packages.scm gnu/services.scm gnu/system.scm gnu/services/configuration.scm +gnu/services/networking.scm gnu/services/shepherd.scm gnu/services/samba.scm gnu/home/services.scm