From patchwork Tue Jun 18 00:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sent X-Patchwork-Id: 65446 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 98D9827BBEB; Tue, 18 Jun 2024 01:51:24 +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 E20AD27BBE2 for ; Tue, 18 Jun 2024 01:51:20 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJN3w-00042E-Hv; Mon, 17 Jun 2024 20:51:04 -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 1sJN3v-00041y-5z for guix-patches@gnu.org; Mon, 17 Jun 2024 20:51:03 -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 1sJN3u-00057P-Ik; Mon, 17 Jun 2024 20:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJN3u-0005CG-B0; Mon, 17 Jun 2024 20:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71561] [PATCH 1/2] services: networking: Allow dhcp-client to use a config file References: <0888b6afe4003512c452fad2bc88370b007fc0ca.1718387578.git.richard@freakingpenguin.com> In-Reply-To: <0888b6afe4003512c452fad2bc88370b007fc0ca.1718387578.git.richard@freakingpenguin.com> Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Tue, 18 Jun 2024 00:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71561 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71561@debbugs.gnu.org Cc: Richard Sent , Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 71561-submit@debbugs.gnu.org id=B71561.171867182919920 (code B ref 71561); Tue, 18 Jun 2024 00:51:02 +0000 Received: (at 71561) by debbugs.gnu.org; 18 Jun 2024 00:50:29 +0000 Received: from localhost ([127.0.0.1]:38630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJN3N-0005B9-86 for submit@debbugs.gnu.org; Mon, 17 Jun 2024 20:50:29 -0400 Received: from mail-108-mta2.mxroute.com ([136.175.108.2]:42493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJN3J-0005Ar-Iz for 71561@debbugs.gnu.org; Mon, 17 Jun 2024 20:50:27 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta2.mxroute.com (ZoneMTA) with ESMTPSA id 19028d2c02e00017a3.001 for <71561@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 18 Jun 2024 00:50:18 +0000 X-Zone-Loop: c6f20fe761421c0f76d79758dd1ed31bacf59443412a X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=00ctH3eh+Xk44C2oMRar+NfUAo4wQadYF68kxkumw58=; b=Q1I73c2gE12MXWXbVSoGBSepxr 4GkA4Ko45XNOtA4H54gfWGAzlXr9cjzOMCcuytjNmkPECEU9Fk6l09uvj5IdiTqVfEVr/vf0pMezl Z8jet58GSE0BD6pbTs8cqpQcyT5JUTxVHAl/aviJ5crAJBfNRSbAW4kJOpA6kp4PFH6+SYDuv8Jxf xDqD9jBrBUshvgtwnuhgcgOoGF4qk+thdLWNDB8e75TBm01X69alWj8AWG7Z6aQlw2AmS+szZNcCB S2uSpU51klxrU/nc75Rvz+B5w8342dwDbxltA/5ZALPKlMaDnKytl9RMbf2dOp7boFdcmY09N7a5A utVTkCrA==; From: Richard Sent Date: Mon, 17 Jun 2024 20:49:12 -0400 Message-ID: MIME-Version: 1.0 X-Authenticated-Id: richard@freakingpenguin.com 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 (dhcp-client-configuration) [config-file]: New field. (dhcp-client-configuration-config-file): New accessor. (dhcp-client-shepherd-service): Use the config file when invoking dhclient if supplied. * doc/guix.texi: Document it. Change-Id: I286de4ddf59c5e606bf1fe0a7510570869e62b1a Reviewed-by: Maxim Cournoyer --- doc/guix.texi | 3 +++ gnu/services/networking.scm | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) base-commit: b993f4735d41e690dbafb8ee2e17fce996a8cf20 diff --git a/doc/guix.texi b/doc/guix.texi index 0102fd0fad..ad67a436ea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21035,6 +21035,9 @@ Networking Setup non-loopback interfaces that can be activated. Otherwise the DHCP client listens only on the specified interfaces. +@item @code{config-file} (default: @code{#f}) +The configuration file for the DHCP client. + @item @code{shepherd-requirement} (default: @code{'()}) @itemx @code{shepherd-provision} (default: @code{'(networking)}) This option can be used to provide a list of symbols naming Shepherd services diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 378e117a86..12d8934e43 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -91,6 +91,7 @@ (define-module (gnu services networking) dhcp-client-configuration? dhcp-client-configuration-package dhcp-client-configuration-interfaces + dhcp-client-configuration-config-file dhcp-client-configuration-shepherd-provision dhcp-client-configuration-shepherd-requirement @@ -319,6 +320,8 @@ (define-record-type* (default '())) (shepherd-provision dhcp-client-configuration-shepherd-provision (default '(networking))) + (config-file dhcp-client-configuration-config-file + (default #f)) (interfaces dhcp-client-configuration-interfaces (default 'all))) ;'all | list of strings @@ -329,6 +332,7 @@ (define dhcp-client-shepherd-service (requirement (dhcp-client-configuration-shepherd-requirement config)) (provision (dhcp-client-configuration-shepherd-provision config)) (interfaces (dhcp-client-configuration-interfaces config)) + (config-file (dhcp-client-configuration-config-file config)) (pid-file "/var/run/dhclient.pid")) (list (shepherd-service (documentation "Set up networking via DHCP.") @@ -364,6 +368,11 @@ (define dhcp-client-shepherd-service (_ #~'#$interfaces)))) + (define config-file-args + (if #$config-file + (list "-cf" #$config-file) + '())) + (false-if-exception (delete-file #$pid-file)) (let ((pid (fork+exec-command ;; By default dhclient uses a @@ -371,8 +380,10 @@ (define dhcp-client-shepherd-service ;; DDNS, which is incompatable with ;; non-ISC DHCP servers; thus, pass '-I'. ;; . - (cons* dhclient "-nw" "-I" - "-pf" #$pid-file ifaces)))) + `(,dhclient "-nw" "-I" + "-pf" ,#$pid-file + ,@config-file-args + ,@ifaces)))) (and (zero? (cdr (waitpid pid))) (read-pid-file #$pid-file))))) (stop #~(make-kill-destructor)))))) From patchwork Tue Jun 18 00:49:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sent X-Patchwork-Id: 65447 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 135DF27BBE2; Tue, 18 Jun 2024 01:51:26 +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 592D027BBE9 for ; Tue, 18 Jun 2024 01:51:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJN3x-00042S-08; Mon, 17 Jun 2024 20:51: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 1sJN3v-00041z-5z for guix-patches@gnu.org; Mon, 17 Jun 2024 20:51:03 -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 1sJN3u-00057R-CT; Mon, 17 Jun 2024 20:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJN3t-0005CA-Sh; Mon, 17 Jun 2024 20:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71561] [PATCH 2/2] doc: Prepend ISC to DHCP client references. Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Tue, 18 Jun 2024 00:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71561 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71561@debbugs.gnu.org Cc: Richard Sent , Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= , Matthew Trzcinski , Maxim Cournoyer Received: via spool by 71561-submit@debbugs.gnu.org id=B71561.171867182919914 (code B ref 71561); Tue, 18 Jun 2024 00:51:01 +0000 Received: (at 71561) by debbugs.gnu.org; 18 Jun 2024 00:50:29 +0000 Received: from localhost ([127.0.0.1]:38628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJN3M-0005B6-PG for submit@debbugs.gnu.org; Mon, 17 Jun 2024 20:50:29 -0400 Received: from mail-108-mta195.mxroute.com ([136.175.108.195]:38755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJN3J-0005As-KV for 71561@debbugs.gnu.org; Mon, 17 Jun 2024 20:50:27 -0400 Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id 19028d2cb0400017a3.001 for <71561@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Tue, 18 Jun 2024 00:50:21 +0000 X-Zone-Loop: 65dcf4d74f29dd232f5205d6e9818b9414cef7791300 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=z3DaJi7CeD4R2AF4ObyE7w+8IYCkAmwBgCVcguUKlZc=; b=e4tGdaMc9Ki5pHfv1majrAiGIF 7fgfMNc3orP5++Ar5ugtDlQm2hoCtjUrYvZoPySwZfWKHBA5lvoyBuhPdlxB27bfstJvFeSStiqLQ 4KR2Qyi2bVYbqP2fn3BxZWAH6l3IDGSmFta2LpTUk+M+2r0luFYHE7gyaNj8xVNdj19kh4I6iD6m4 ioAxFFqsEoLoaTIdnQn32FEOzPeasyDuRAiBarsUoPjxK2xsqQ/Ul8AIeQbdvCPH6y2O5e5GE04VQ FGoe6zrG8PoVfnhgmY++etNMeqCW/V426S+txrbno2Lb/7sW31f4vIUrHSjcZqR4VZ0xYZA9h86Ox 2IAdDkmA==; From: Richard Sent Date: Mon, 17 Jun 2024 20:49:13 -0400 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Authenticated-Id: richard@freakingpenguin.com 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 This makes it clearer that this service uses the ISC's dhclient implementation and does not support DHCP clients that have different command line interfaces. * doc/guix.texi (Networking Setup): Prepend ISC to all DHCP client references. Change-Id: I750ef2ffb4b23445c4a2b97aaa44eba56458f430 Reviewed-by: Maxim Cournoyer --- doc/guix.texi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ad67a436ea..8dd3bee5ca 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21016,27 +21016,27 @@ Networking Setup @cindex DHCP, networking service @defvar dhcp-client-service-type -This is the type of services that run @var{dhcp}, a Dynamic Host Configuration -Protocol (DHCP) client. +This is the type of services that run @var{dhclient}, the ISC Dynamic +Host Configuration Protocol (DHCP) client. @end defvar @deftp {Data Type} dhcp-client-configuration -Data type representing the configuration of the DHCP client service. +Data type representing the configuration of the ISC DHCP client service. @table @asis @item @code{package} (default: @code{isc-dhcp}) -DHCP client package to use. +The ISC DHCP client package to use. @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")}. +Either @code{'all} or the list of interface names that the ISC 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. +When set to @code{'all}, the ISC DHCP client listens on all the +available non-loopback interfaces that can be activated. Otherwise the +ISC DHCP client listens only on the specified interfaces. @item @code{config-file} (default: @code{#f}) -The configuration file for the DHCP client. +The configuration file for the ISC DHCP client. @item @code{shepherd-requirement} (default: @code{'()}) @itemx @code{shepherd-provision} (default: @code{'(networking)}) @@ -21047,7 +21047,7 @@ Networking Setup Likewise, @code{shepherd-provision} is a list of Shepherd service names (symbols) provided by this service. You might want to change the -default value if you intend to run several DHCP clients, only one of +default value if you intend to run several ISC DHCP clients, only one of which provides the @code{networking} Shepherd service. @end table @end deftp