From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id cCSgIN+kcGbZFgAAe85BDQ:P1 (envelope-from ) for ; Mon, 17 Jun 2024 21:04:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id cCSgIN+kcGbZFgAAe85BDQ (envelope-from ) for ; Mon, 17 Jun 2024 23:04:31 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KyejVTWa; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718658271; a=rsa-sha256; cv=none; b=bPY153MojWWMyL0sj4HjwF7uNoIAjQcHQfKatuK00Hmbk153IBGm5qSDZLdBfe7L/oGQwW XW/N2qOBsdfRuzfcyKQWuXlCBGVsmomjQVQoGXq/NhGeLyxgvN02nMiy30qU4R09OPelgh MFP0fcimMA0JM3ewXaF5odC7kJtLOR6YNtQIhhW994Z3oJ7SvXqYQh6fHdvKIFI/nScmeT +GnP7Xa/sWhIHKfaihUbCGcmtPPuEK3I4taapmp0F5eMYUmGR83TFrdABL6D9oMFJ4IWKz /nH4fUmiAOp+0rFfnQp3RsRQUsfA45HO5z89LRsSsg4pvDLmeGCy6BwD97icUw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KyejVTWa; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718658271; 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-cc: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=6ZbCuRSfdAfIlRKpFB0qTDPBwo9SSlylgkTUFvkt1pY=; b=gTc8OcgaZ63myyQTFpPi7X2GkXGI46YLMRIww9Z31Y2gh+Qq3wYe5sBLtTeEeMykrVTpW/ 1p4+UM9orsqsZ8+KjYY4Jc2upMRMFZg25mUkmgbhfTuqPSJ0j7UoP8GGv9YetAHmlXPSqp b1aIzM2ah4bIFZl1nNoK/thKMiDO1pS8rqmDrAq6mOXwipUv3hiSW+kteHMm/DMt5otWjF YeJH8m6olA4ZI9l4V+WEq5jSSkk5jo+5a+1QveQhTqGxJnxS7yWSe6hORZ87ljzlVerAid +CA0hxj53aaLN7rfQPJ5EInhHUOr5o9MJxPinHFzr0XLzEbZ9iBraLmmQenmbg== 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 383FE6A045 for ; Mon, 17 Jun 2024 23:04:31 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJJWK-0001JM-0m; Mon, 17 Jun 2024 17:04:08 -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 1sJJWC-0001Hd-Ez for guix-patches@gnu.org; Mon, 17 Jun 2024 17:04:00 -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 1sJJWC-0001v3-1L for guix-patches@gnu.org; Mon, 17 Jun 2024 17:04:00 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJJWE-0004Wj-6a for guix-patches@gnu.org; Mon, 17 Jun 2024 17:04:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71561] [PATCH] services: networking: Allow dhcp-client to use a config file Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Jun 2024 21:04: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: Richard Sent Cc: 71561@debbugs.gnu.org, Ludovic =?UTF-8?Q?Court=C3=A8s?= , Florian Pelz , Matthew Trzcinski Received: via spool by 71561-submit@debbugs.gnu.org id=B71561.171865818317227 (code B ref 71561); Mon, 17 Jun 2024 21:04:02 +0000 Received: (at 71561) by debbugs.gnu.org; 17 Jun 2024 21:03:03 +0000 Received: from localhost ([127.0.0.1]:37550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJJVH-0004Tm-6a for submit@debbugs.gnu.org; Mon, 17 Jun 2024 17:03:03 -0400 Received: from mail-ot1-f44.google.com ([209.85.210.44]:44261) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJJVE-0004TH-Gv for 71561@debbugs.gnu.org; Mon, 17 Jun 2024 17:03:01 -0400 Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6f9a4f9923aso2696101a34.0 for <71561@debbugs.gnu.org>; Mon, 17 Jun 2024 14:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718658112; x=1719262912; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=6ZbCuRSfdAfIlRKpFB0qTDPBwo9SSlylgkTUFvkt1pY=; b=KyejVTWafy2Y78Y7l+UMJojn+y9AEUHQOfU1DFHG4UAuFvcqes2IiWa+6ZTfiYhZK6 BKxP7y4/OrcDVzfRif40Z+aYHIoUY2kKwXU8FVk4X3SCvEXS+9hAe85OQzstxAjg1wa9 +/3uPwkStR/GoXhSQJmE+EYdjTDuhq8KY5FWjulcXw/GZ28WvZkZKkfcbfvYZaOMHge8 zfouirSTEuG1s4W1t8apzmvaadhfTGsWLWjyQ6jMjxr2EMp7Mw+pe2vDivedg+XCHdY1 jE+uQ6Yl6b1rJZxV6bSU7D+p0p4QogGZdLPdZjCz/pCJEbMculBrodbCcCGpSRvWq0B2 ryxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718658112; x=1719262912; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6ZbCuRSfdAfIlRKpFB0qTDPBwo9SSlylgkTUFvkt1pY=; b=OeytxwtiMJbCNBcbGl/QEYUxdGw5JaO8/badA1sz16SlEM1Z2JMEiv/X7QU1Jkwv/U ntRGQKBQa7hzMB1BLANfC2N7Kzsc53xbLOKk7peoZSihbMrw8QCIk9LNDRG6gmV+QFBy gd/7OpoYFZhN6O2CoERGgdCPCSHgi/4rWXXpnymWB9JE1pedHZAutCvVe4jNr3avw5hw l4Af1fwo4jRMNLAOVX47dM8fpps9Xc3jyJ9HjW++kZAXI/FtsFSetbTfs5TMkDbAM7Zs Y+jrUXhATafUQbej3n2txuYjAl3WoGDcjTSFyxqXBIIzFXNf4IUFqM5WeT0KwoLpCCDV KZVQ== X-Gm-Message-State: AOJu0YzhKhA3k8Ti8UTeiuxZWdxgO5B7Nn3tZf0D02ObNqXBV/bN/kHC EJxgmUwK1bpJFxOuDyTbLm1M10Kg0msv7DqIQOs8BzIIg1jI3EBB X-Google-Smtp-Source: AGHT+IEL3C8da+VB/KQGnlgfhfF1InWpetom8ReaOEzF5SczmG56w5hFB7aMwcilRvL6H/DPjO5IUA== X-Received: by 2002:a05:6830:1395:b0:6f9:b82b:a09c with SMTP id 46e09a7af769-6fb9364aa27mr11653086a34.7.1718658112270; Mon, 17 Jun 2024 14:01:52 -0700 (PDT) Received: from hurd (dsl-158-184.b2b2c.ca. [66.158.158.184]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b2a5bf2ae0sm59114146d6.22.2024.06.17.14.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jun 2024 14:01:51 -0700 (PDT) From: Maxim Cournoyer In-Reply-To: <0888b6afe4003512c452fad2bc88370b007fc0ca.1718387578.git.richard@freakingpenguin.com> (Richard Sent's message of "Fri, 14 Jun 2024 13:52:58 -0400") References: <0888b6afe4003512c452fad2bc88370b007fc0ca.1718387578.git.richard@freakingpenguin.com> Date: Mon, 17 Jun 2024 17:01:50 -0400 Message-ID: <87o77zfflt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -5.26 X-Migadu-Scanner: mx12.migadu.com X-Spam-Score: -5.26 X-Migadu-Queue-Id: 383FE6A045 X-TUID: ZrhigGAxfY1z Hi Richard, Richard Sent writes: > * gnu/services/networking (dhcp-client-configuration): Create Nitpick: The file name should be complete, including the extension. Pressing 'C' on the diff's hunk while authoring a commit message in Magit (Emacs) creates a ChangeLog entry automatically, if that helps. > dhcp-client-configuration-config-file. I'd perhaps reword this to: (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 > --- > Hi all. > > This patch adds support for providing dhcp-client a configuration > file, which is a file of the form > https://man.archlinux.org/man/dhclient.conf.5. I believe this can be > used to resolve > https://lists.gnu.org/archive/html/help-guix/2024-06/msg00071.html > using the instructions at https://unix.stackexchange.com/a/399694, > although I haven't confirmed that. Either way, adding more flexibility > to the service is a good thing in my eyes. I think it's a good thing to have the 'escape hatch' implemented by many services! > doc/guix.texi | 3 +++ > gnu/services/networking.scm | 15 +++++++++++++-- > 2 files changed, 16 insertions(+), 2 deletions(-) > > 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)))))) Reviewed-by: Maxim Cournoyer Thanks, Maxim