From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id SMxkE+H/PWMfRAEAbAwnHQ (envelope-from ) for ; Thu, 06 Oct 2022 00:06:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +G1oE+H/PWNScAEA9RJhRA (envelope-from ) for ; Thu, 06 Oct 2022 00:06:25 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id F01BD171D1 for ; Thu, 6 Oct 2022 00:06:24 +0200 (CEST) Received: from localhost ([::1]:56938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogCX2-00072z-33 for larch@yhetil.org; Wed, 05 Oct 2022 18:06:24 -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 Content-Type: multipart/mixed; boundary="=-=-=" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665007585; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-to:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=cGrCAi6K9aSaJMh512ubSqNsN4HVjdQYohya/iA2xfA=; b=MiiMtwwxlPiWDf2SCyH+No5G3+wQ3N4t3Y3JHgT8etKrYlUShyYeQcyZBtYobV+XgwqHi3 yXuLGiUZ3mfzptDcVmhmzkGE4MdivymfBaKtBxH5Ku1TVBnKNr9fvUJMxbV2r6pIEH5+/f XyJzRvtHPDXRsVi8RWUEiu4lhTNKXL2k6u8DIF48Ly3Cc4fz/tZqM7xDLmMmlJ1YWeWv3G lYZBRJdpJOGxjQ4PP2lh+Sv15/ESf7DW1ot4lfS3yPF+Aoi3FdN5NUXr8FVMW7/sbShghb FuDdpF2e9qg3um0AohP79vcgGiM3eVyT5VA+sFT33jaCBWZu9+xcZLuGK9O3SQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665007585; a=rsa-sha256; cv=none; b=Q6fwzK1W87HLX5YH7hIwbOVwIqGKOG9D1duqncMiv6GxzpDi4RnW/FJR8eSklrogBWAi4D wxdyuUy+xQiK/wYRRCq+hixqOf8ey8/QtMLYzKSBySUoVsPXz9IygIk9vjfS8zZQR5WS1M rLEZ+FYgAtsojApRbXnAGTLajQSWFGJjmO2lRyxui0qFQSLXGd6m0zsgDzojrNrYaEUqow GgFjUEDMpM1vsmgYkwys3BC2X3cVZJLJHCE+UjWRYz+iMqnOIJII+COSuUznMrxL4Id/IU Y2CjkwM9JLADZdqQ8MtvLc/Wlb7POgoiTuPPb7ewdVKWLTDfWJmKBErDG488KA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="e/dj98b/"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="e/dj98b/"; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: F01BD171D1 X-Spam-Score: -3.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: qg6lXaoVK7nM --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-nam= es)))) This isn=E2=80=99t quite right since '() is always true. For this and for aesthetic reasons, I changed =E2=80=98interfaces=E2=80=99 = such that it must be either 'all or a list. Applied with the changes below, thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 --=-=-=--