GNU bug report logs - #68675
[PATCH] Support dhcpcd in dhcp-client-service-type

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: soeren@HIDDEN; Keywords: patch; dated Tue, 23 Jan 2024 16:14:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 5 Jan 2025 16:21:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 05 11:21:01 2025
Received: from localhost ([127.0.0.1]:34921 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tUTN7-0003oV-Kb
	for submit <at> debbugs.gnu.org; Sun, 05 Jan 2025 11:21:01 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:19416)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <soeren@HIDDEN>)
 id 1tUTN4-0003oJ-LR
 for 68675 <at> debbugs.gnu.org; Sun, 05 Jan 2025 11:21:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=opensmtpd; bh=mVQZpk4O
 w6PKei3jycXHRAQ3Qm7f3wNd76en6M2asAE=; h=from:subject:cc:to:date;
 d=soeren-tempel.net; b=w5B15VuRJQ/qnuSOs8YBVyvFRZz6VK+p8sn/OJYVkJZdaXp
 Vk2YsKgaxTDmRjwA3B1LCLWguCFaaANISOcyuJ4AbECnjW40mjesP+Ma22WItjwBcrh03U
 jrLW46ZQtoKUsdPjvhYJwwmTvFMfcI8xYEWDwAxat3Qr/uXTkDOIec=
Received: from localhost (<unknown> [2a02:560:4d3d:df00:9962:a9f8:8b9c:aa09])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id ec45de1d
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Sun, 5 Jan 2025 17:20:56 +0100 (CET)
Date: Sun, 05 Jan 2025 17:20:55 +0100
To: 68675 <at> debbugs.gnu.org
Subject: Re: [PATCH] Support dhcpcd in dhcp-client-service-type
From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
Message-Id: <3ADU75PCO8T5K.2GS26ETA30AJR@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 68675
Cc: Quelln@HIDDEN, ludo@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Quelln wrote:
> I just wanted to as the status on this, considering it's almost the
> new year. ISC-dhcp has been deprecated for a long time now, maybe it's
> time to merge these patches and resolve any blockers that remain?

I am very much still interested in working on this, I have been using
Guix with dhcpcd every since (though with a slightly different service
definition) and haven't encountered any issues since.

I can refactor the existing dhcp-client-service to not rely on PID file
supervision. Alternatively, in case this makes review easier, I can also
submit the package separately so that we can discuss the package
decoupled from the service definition.

Regarding the service, it may also be worthwhile to add a custom service
for dhcpcd instead of extending the existing one. Though that would make
migrating to dhcpcd from isc-dhcp more involved for users.

WDYT? How do we best proceed here?

Greetings,
S=C3=B6ren




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 30 Dec 2024 18:30:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 30 13:30:45 2024
Received: from localhost ([127.0.0.1]:59940 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tSKXM-0008TA-8T
	for submit <at> debbugs.gnu.org; Mon, 30 Dec 2024 13:30:45 -0500
Received: from mail-10699.protonmail.ch ([79.135.106.99]:53415)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <Quelln@HIDDEN>) id 1tSJ2a-0003jv-2O
 for 68675 <at> debbugs.gnu.org; Mon, 30 Dec 2024 11:54:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
 s=protonmail3; t=1735577685; x=1735836885;
 bh=zEoY6LZO+eU5VizlcNEi3jXltNoNtSUys4DOzS2BE6I=;
 h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:
 Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector:
 List-Unsubscribe:List-Unsubscribe-Post;
 b=NLlmXnFEY6j8BCWZ6B0PEHHoQZYU9s3UwHYn8W4dWoOuwBGpj+q/YyyrAsBBZG2n3
 OKSz4fDKXd4C/yB6SXk21ywp3zua6UqODqfB0DR0F43bxP5QLOEceBoLsFIFTOcCNq
 KZm9NiJk0bX1k56RJhNe9YfjAJuDXcR5DlJNrhow/1O/BS4Thw0ZTiiXwwZFp47XKQ
 ZQk9rmiJ/XzU9NJnZ9+bs6d4aP7jQ1NBjIl7f1PmInttzc9pyxZQ/fuYNIbr41EbHB
 CJSZ4yaZNQs4y7aVxrCyMJtbgto6aNhC3ih0iZmz92FUWnU6WAWdv3+U0Py7OMwpv2
 /dFdw/bIscgVA==
Date: Mon, 30 Dec 2024 16:54:39 +0000
To: "68675 <at> debbugs.gnu.org" <68675 <at> debbugs.gnu.org>
From: Quelln <Quelln@HIDDEN>
Subject: (No Subject)
Message-ID: <12bocTx_c4g2sd-yTbbfEwzrecDZ_P8vI0Eim34SBalYUiloHyd-mrin1Dw3pH1RCzPovsDHPKRXRMoulLT5FGES56ZOmJr64_MLG7z3K-c=@protonmail.com>
Feedback-ID: 103460510:user:proton
X-Pm-Message-ID: a80a62c3c90dc9811c760fd07de0cb74de73fc8a
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="b1=_g1MnipFMaAqBSGLuOyXTut7b8LfXA0hY9qemTnWpM"
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hello, I just wanted to as the status on this, considering
 it's almost the new year. ISC-dhcp has been deprecated for a long time now,
 maybe it's time to merge these patches and resolve any blockers that rem
 [...] Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 2.0 SLIGHTLY_BAD_SUBJECT   Subject contains something slightly spammy
 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE:
 The query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [79.135.106.99 listed in sa-accredit.habeas.com]
 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The
 query to Validity was blocked.  See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243
 for more information.
 [79.135.106.99 listed in bl.score.senderscore.com]
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (quelln[at]protonmail.com)
 0.0 RCVD_IN_MSPIKE_H4      RBL: Very Good reputation (+4)
 [79.135.106.99 listed in wl.mailspike.net]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 HTML_MESSAGE           BODY: HTML included in message
 0.0 RCVD_IN_MSPIKE_WL      Mailspike good senders
X-Debbugs-Envelope-To: 68675
X-Mailman-Approved-At: Mon, 30 Dec 2024 13:30:42 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

--b1=_g1MnipFMaAqBSGLuOyXTut7b8LfXA0hY9qemTnWpM
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64

SGVsbG8sCgpJIGp1c3Qgd2FudGVkIHRvIGFzIHRoZSBzdGF0dXMgb24gdGhpcywgY29uc2lkZXJp
bmcgaXQncyBhbG1vc3QgdGhlIG5ldyB5ZWFyLgpJU0MtZGhjcCBoYXMgYmVlbiBkZXByZWNhdGVk
IGZvciBhIGxvbmcgdGltZSBub3csIG1heWJlIGl0J3MgdGltZSB0byBtZXJnZSB0aGVzZSBwYXRj
aGVzIGFuZCByZXNvbHZlIGFueSBibG9ja2VycyB0aGF0IHJlbWFpbj8=

--b1=_g1MnipFMaAqBSGLuOyXTut7b8LfXA0hY9qemTnWpM
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64

PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IEFyaWFsLCBzYW5zLXNlcmlmOyBmb250LXNpemU6IDE0
cHg7Ij48YnI+PC9kaXY+PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IEFyaWFsLCBzYW5zLXNlcmlm
OyBmb250LXNpemU6IDE0cHg7Ij5IZWxsbyw8L2Rpdj48ZGl2IHN0eWxlPSJmb250LWZhbWlseTog
QXJpYWwsIHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTogMTRweDsiPjxicj48L2Rpdj48ZGl2IHN0eWxl
PSJmb250LWZhbWlseTogQXJpYWwsIHNhbnMtc2VyaWY7IGZvbnQtc2l6ZTogMTRweDsiPkkganVz
dCB3YW50ZWQgdG8gYXMgdGhlIHN0YXR1cyBvbiB0aGlzLCBjb25zaWRlcmluZyBpdCdzIGFsbW9z
dCB0aGUgbmV3IHllYXIuPC9kaXY+PGRpdiBzdHlsZT0iZm9udC1mYW1pbHk6IEFyaWFsLCBzYW5z
LXNlcmlmOyBmb250LXNpemU6IDE0cHg7Ij5JU0MtZGhjcCBoYXMgYmVlbiBkZXByZWNhdGVkIGZv
ciBhIGxvbmcgdGltZSBub3csIG1heWJlIGl0J3MgdGltZSB0byBtZXJnZSB0aGVzZSBwYXRjaGVz
IGFuZCByZXNvbHZlIGFueSBibG9ja2VycyB0aGF0IHJlbWFpbj88L2Rpdj4NCg==


--b1=_g1MnipFMaAqBSGLuOyXTut7b8LfXA0hY9qemTnWpM--





Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 11 Mar 2024 09:11:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 11 05:11:08 2024
Received: from localhost ([127.0.0.1]:38729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rjbga-0007fP-72
	for submit <at> debbugs.gnu.org; Mon, 11 Mar 2024 05:11:08 -0400
Received: from magnesium.8pit.net ([45.76.88.171]:18876)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1rjbgX-0007fC-JL
 for 68675 <at> debbugs.gnu.org; Mon, 11 Mar 2024 05:11:06 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=opensmtpd; bh=JZI8Z5a6
 trxCN+6osVnsjosoxadhxj2rElKUdN+IgFw=;
 h=in-reply-to:references:from:
 subject:cc:to:date; d=soeren-tempel.net; b=BFyoS+2gtikqivTZEm4O0SUG07n
 NDTLGEmfd7XrPGGEgJk6AitTsb9+85+cAVUrBMANTLOmKtJj6HpcNHZF5JFUX0ykQZxK41
 M1VR2yo2D08KosU5g7hH18EJp+YlxtwOwYtmw1NRX9ukoszoJLwtRJVs28vn3oc+lWrSJL
 jgKQ=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-64ba-7ea6-b5d2-00d0.310.pool.telefonica.de
 [2a02:3102:49da:1b:64ba:7ea6:b5d2:d0])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id c4749531
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Mon, 11 Mar 2024 10:10:30 +0100 (CET)
Date: Mon, 11 Mar 2024 10:10:24 +0100
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#68675] [PATCH v3 2/2] services: dhcp: Support the dhcpcd
 implementation.
From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
References: <5c6f714f4802ec17bc247e701bcee82d54733005.1707828643.git.soeren@HIDDEN>
 <bfd99f266c3fd749c6b24b386a7ac90dc89ce338.1707828643.git.soeren@HIDDEN>
 <87plwgfgyo.fsf@HIDDEN>
In-Reply-To: <87plwgfgyo.fsf@HIDDEN>
Message-Id: <36K6QAPI5E9CA.21QTTSML4N08U@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
> Apologies for the late reply.

No worries, I understand that you have a lot of other things to do :)

> I would very much like to avoid the =E2=80=98open-input-pipe=E2=80=99 dan=
ce here.  Maybe
> there=E2=80=99s a way to ask it to not fork, in which case we don=E2=80=99=
t need to wait
> for a PID file?

When using a PID file, AFAIK the only thing we can do is replicate the C
code that I referenced in my prior email for determining the PID file
name [1]. Is there a specific reason why you want to avoid using
open-input-pipe?

> What do others do?  I guess it=E2=80=99s not possible to have a systemd .=
service
> file given those PID file semantics, is it?

systemd and other service supervisor do not rely on PID files for
services supervision as they are inherently racy. Therefore, as
mentioned in my prior email, I also think it would be preferable to not
use a PID file for supervising either dhclient or dhcpcd.

I only ended up using a PID file here as dhclient already used one and I
wanted to keep the service changes as minimal as possible to ensure a
swift review since I believe this to be a security-critical issue (see
Guix issue #68619).

> Two notes: I would find it clearer to call =E2=80=98fork+exec-command=
=E2=80=99 above
> instead of constructing =E2=80=98exec-config=E2=80=99.
>=20
> Ideally, we=E2=80=99d use:
>=20
>   (start #~(if (file-exists? (string-append #$package "/bin/dhclient"))
>                (make-forkexec-constructor =E2=80=A6)   ;ISC version, with=
 #:pid-file
>                (make-forkexec-constructor =E2=80=A6))) ;dhcpcd, maybe wit=
hout #:pid-file

If we separate the dhclient and the dhcpcd code like this, then it may
be worthwhile to have entirely separated services instead of combining
them both in a single service. This would also ease providing a
configuration for these services.

> Maybe that is too naive, but at least we should get as close as possible
> to that, for instance by avoiding direct calls to =E2=80=98fork+exec-comm=
and=E2=80=99 +
> =E2=80=98waitpid=E2=80=99 + =E2=80=98read-pid-file=E2=80=99 as much as po=
ssible.

Ideally, I would not want to refactor existing service code as much in
this patchset. As mentioned above, I believe Guix using dhclient by
default (which has been EOL for 2 years) has security implications.
Therefore, I would want to migrate dhcp-client-service-type away from
dhclient to dhcpcd as soon as possible. As part of this migration, I
would strongly suggest a deprecation and removal of dhclient support
from dhcp-client-service-type. As soon as dhclient support is removed,
refactorings of dhcp-client-service-type can be conducted. Including a
removal of PID files for supervision, instead supervising dhcpcd by
spawning it as non-double-forking child process [2].

Greetings
S=C3=B6ren

[1]: https://github.com/NetworkConfiguration/dhcpcd/blob/v10.0.6/src/dhcpcd=
.c#L2144
[2]: https://github.com/nmeum/guix-channel/blob/b1b80697a9d35ca015ce56ccf30=
31f91f2bf554f/src/nmeum/services/networking.scm#L209-L211




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 28 Feb 2024 20:55:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 28 15:55:27 2024
Received: from localhost ([127.0.0.1]:42756 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rfQxa-0002yJ-8B
	for submit <at> debbugs.gnu.org; Wed, 28 Feb 2024 15:55:26 -0500
Received: from eggs.gnu.org ([209.51.188.92]:37360)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1rfQwd-0002v3-Iv
 for 68675 <at> debbugs.gnu.org; Wed, 28 Feb 2024 15:54:28 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1rfQw6-0000Py-Jd; Wed, 28 Feb 2024 15:53:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=1bXGvrXtYU6T5ck/vbZQpLiNIxMGd3nNBLe7Q4o9rVg=; b=OIWxfZQRfl83D48G7Uc6
 y6dGn5zuQUJeRKQ+QvzwPNMVSoVn/CyveOeMqP33hyGuaSQw1jSPTRl80IeuaATs79mCKqh05D+39
 AIA5YaqRDJBvN3HY3RfHaZ56w3jdMeXioicU5dRVTqrJ2gWkfKs1al+aVO2v56hivtj58slmdFOmP
 2jNs6h575k1Z1BwQXCiuSAPhgR73H1KAdaXFbhUNcfcTZCeS9Y9rcGh/vjtLfsTTx+CWPOYxGF2yd
 IPZoHhwVPplIDAvY+NTR25kbAgNv4uxBZGEPRJqlBCmNhuCox/W98KAsYrBaaNFJdOXYMrYt4pxFI
 5SYspeqlc8m16Q==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: soeren@HIDDEN
Subject: Re: [bug#68675] [PATCH v3 2/2] services: dhcp: Support the dhcpcd
 implementation.
In-Reply-To: <bfd99f266c3fd749c6b24b386a7ac90dc89ce338.1707828643.git.soeren@HIDDEN>
 (soeren@HIDDEN's message of "Tue, 13 Feb 2024 13:50:43
 +0100")
References: <5c6f714f4802ec17bc247e701bcee82d54733005.1707828643.git.soeren@HIDDEN>
 <bfd99f266c3fd749c6b24b386a7ac90dc89ce338.1707828643.git.soeren@HIDDEN>
Date: Wed, 28 Feb 2024 21:53:51 +0100
Message-ID: <87plwgfgyo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello,

soeren@HIDDEN skribis:

> * gnu/services/networking.scm (dhcp-client-shepherd-service): Add
>   support for the dhcpcd client implementation.
> * gnu/services/networking.scm (dhcp-client-account-service): New
>   procedure.
> * gnu/services/networking.scm (dhcp-client-service-type): Add optional
>   account-service-type extensions (needed for dhcpcd).
> * gnu/system.scm (%base-packages-networking): Remove isc-dhcp from
>   %base-packages (will be pulled in by dhcp-client-shepherd-service).

[...]

> +                         ;; Returns the execution configuration for the =
DHCP client
> +                         ;; selected by the package field of dhcp-client=
-configuration.
> +                         ;; The configuration is a pair of pidfile and e=
xecution command
> +                         ;; where the latter is a list.
> +                         (define exec-config
> +                           (case (string->symbol #$client-name)
> +                             ((isc-dhcp)
> +                              (let ((pid-file "/var/run/dhclient.pid"))
> +                                (cons
> +                                  (cons* (string-append #$package "/sbin=
/dhclient")
> +                                         "-nw" "-I" "-pf" pid-file iface=
s)
> +                                  pid-file)))
> +                             ((dhcpcd)
> +                              ;; For dhcpcd, the utilized pid-file depen=
ds on the
> +                              ;; command-line arguments.  If multiple in=
terfaces are
> +                              ;; given, a different pid-file is returned=
.  Hence, we
> +                              ;; consult dhcpcd itself to determine the =
pid-file.
> +                              (let* ((cmd (string-append #$package "/sbi=
n/dhcpcd"))
> +                                     (arg (cons* cmd "-b" ifaces)))
> +                                (cons arg
> +                                  (let* ((pipe (string-join (append arg =
'("-P")) " "))
> +                                         (port (open-input-pipe pipe))
> +                                         (path (read-line port)))
> +                                    (close-pipe port)
> +                                    path))))
> +                             (else
> +                               (display
> +                                 "unknown 'package' value in dhcp-client=
-configuration"
> +                                 (current-error-port))
> +                               (newline (current-error-port))
> +                               #f)))
> +

I would very much like to avoid the =E2=80=98open-input-pipe=E2=80=99 dance=
 here.  Maybe
there=E2=80=99s a way to ask it to not fork, in which case we don=E2=80=99t=
 need to wait
for a PID file?  (I=E2=80=99ll give up if this really really can=E2=80=99t =
be avoided.  :-))

> +                         (and
> +                           exec-config
> +                           (let ((pid-file (cdr exec-config))
> +                                 (exec-cmd (car exec-config)))
> +                             (false-if-exception (delete-file pid-file))
> +                             (let ((pid (fork+exec-command exec-cmd)))
> +                               (and (zero? (cdr (waitpid pid)))
> +                                    (read-pid-file pid-file)))))))

Two notes: I would find it clearer to call =E2=80=98fork+exec-command=E2=80=
=99 above
instead of constructing =E2=80=98exec-config=E2=80=99.

Ideally, we=E2=80=99d use:

  (start #~(if (file-exists? (string-append #$package "/bin/dhclient"))
               (make-forkexec-constructor =E2=80=A6)   ;ISC version, with #=
:pid-file
               (make-forkexec-constructor =E2=80=A6))) ;dhcpcd, maybe witho=
ut #:pid-file

Maybe that is too naive, but at least we should get as close as possible
to that, for instance by avoiding direct calls to =E2=80=98fork+exec-comman=
d=E2=80=99 +
=E2=80=98waitpid=E2=80=99 + =E2=80=98read-pid-file=E2=80=99 as much as poss=
ible.

HTH!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 28 Feb 2024 20:47:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 28 15:47:04 2024
Received: from localhost ([127.0.0.1]:42085 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rfQpT-0002TP-Gx
	for submit <at> debbugs.gnu.org; Wed, 28 Feb 2024 15:47:04 -0500
Received: from eggs.gnu.org ([209.51.188.92]:56922)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1rfQpO-0002Sb-C5
 for 68675 <at> debbugs.gnu.org; Wed, 28 Feb 2024 15:47:02 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1rfQor-0006Dg-3j; Wed, 28 Feb 2024 15:46:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=hg/TL1miv9ts9bfbea+PRML7fugmX/sEpJjfZXbEQuU=; b=mWz3AzsRfFHKyA8pAfab
 hmvt/icYJz3TaRkz8v57lObMgmTCx6hYgx21HkNobUJiuBske0PoVVLfpGDacCqS+4S/OyE3G8oJL
 F/4oS1uihOBG/2yeQASj10HGN1DFKm9qu0sBOoCSXRqHi+BBI/77NJ7cuiHbJyoKAh94d/j7u0iQM
 UYY4/psucbLEq08W156KwWhemq24dfDwAJFq0JxP0jv6bjdZehrZC0lCgWHYwdtZjYCwueohVWmEn
 NUdfQlYGxiha+HyaOQaQnb2Tbl4TfdF7HVJbg8OPtZIdVQwH5rcTFhOfPJ0xJ7FOwXnADIiFVAT1I
 SSx6R0BVFXFEWw==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: =?utf-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
Subject: Re: [bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd
 implementation.
In-Reply-To: <2W69OW2TSRJI1.2UCT83W2YH8FC@HIDDEN> (=?utf-8?Q?=22S=C3=B6r?=
 =?utf-8?Q?en?= Tempel"'s message
 of "Tue, 13 Feb 2024 13:52:15 +0100")
References: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
 <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@HIDDEN>
 <87ttmdbbs9.fsf@HIDDEN> <2W69OW2TSRJI1.2UCT83W2YH8FC@HIDDEN>
Date: Wed, 28 Feb 2024 21:46:16 +0100
Message-ID: <87v868fhbb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi S=C3=B6ren,

Apologies for the late reply.

S=C3=B6ren Tempel <soeren@HIDDEN> skribis:

> Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
>> Instead of calling =E2=80=98package-name=E2=80=99, which would prevent t=
he use of
>> something other than a <package> record (such as an <inferior-package>)
>> or a package with a different name (like =E2=80=9Cdhcpcd-next=E2=80=9D),=
 what about
>> checking in the gexp which of /bin/dhclient and /bin/dhcpcd exists?
>
> I think I haven't fully grasped G-Expressions yet. I do understand how
> this would work inside the shepherd start gexp. However, I am not sure
> how I would check if /bin/dhclient or /bin/dhcpcd exist in the package
> within the dhcp-client-account-service since, at least as far as
> I understand, the dhcp-client-account-service is itself not a gexp.

I meant, within the =E2=80=98start=E2=80=99 method, something like:

  (start #~(=E2=80=A6
             ;; Check whether we=E2=80=99re dealing with ISC=E2=80=99s dhcl=
ient or dhcpcd.
             (let ((type (if (file-exists?
                              (string-append #$package "/bin/dhclient"))
                             'isc-dhcp
                             'dhcpcd)))
               (fork+exec-command =E2=80=A6))))

Does that make sense?

>> That sounds quite complex.  Surely there must be a way to force the name
>> of the PID file or to determine its name without running dhcpcd in a
>> pipe?
>
> Unfortunately, I don't think there is any way to force the PID file
> name. Furthermore, the pidfile path depends on the amount interfaces
> specified. If there is only one interface, a single dhcpcd instance is
> spawned and the pidfile refers to that. Otherwise, a management process
> is started and the pidfile refers to the management process [1].
>
> I think the best solution here would be to spawn dhcpcd as child process
> of GNU shepherd and have shepherd supervise it that way. I have a service
> doing that too, but its annoying to integrate with the existing dhclient
> service [2]. Maybe that's something we can migrate to in the long run.

What do others do?  I guess it=E2=80=99s not possible to have a systemd .se=
rvice
file given those PID file semantics, is it?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 13 Feb 2024 12:59:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 13 07:59:21 2024
Received: from localhost ([127.0.0.1]:42944 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rZsNc-0005FN-TW
	for submit <at> debbugs.gnu.org; Tue, 13 Feb 2024 07:59:21 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:43671)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1rZsNW-0005F8-RT
 for 68675 <at> debbugs.gnu.org; Tue, 13 Feb 2024 07:59:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=qmkLtMLaqt
 +qTUOz9Zzji1Isx/AIiVYLcydn1m8CDlg=;
 h=in-reply-to:references:from:
 subject:cc:to:date; d=soeren-tempel.net; b=PXOJGKLRhnXS/XCaKT3i446QnjA
 7fakBMP9xYttE+vNhcYGjZOZmBEMspkA+hGHGKfPw6dO7Lh2l1CvrWK949HjfxZ+qPWXvM
 ZLH2EqJDR1aoMJ2u19TimMeRNyvJC2DV1v3bGAcHz7AJKg2/P05Q+AxEDFOZR6cjstWK5L
 vgxc=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-df49-33b7-2af2-ff52.310.pool.telefonica.de
 [2a02:3102:49da:1b:df49:33b7:2af2:ff52])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 13f99a49
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 13 Feb 2024 13:52:16 +0100 (CET)
Date: Tue, 13 Feb 2024 13:52:15 +0100
To: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd
 implementation.
From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
References: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
 <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@HIDDEN>
 <87ttmdbbs9.fsf@HIDDEN>
In-Reply-To: <87ttmdbbs9.fsf@HIDDEN>
Message-Id: <2W69OW2TSRJI1.2UCT83W2YH8FC@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Ludovic,

Thanks a lot for the feedback, really truly helpful! More comments below.

Ludovic Court=C3=A8s <ludo@HIDDEN> wrote:
> Instead of calling =E2=80=98package-name=E2=80=99, which would prevent th=
e use of
> something other than a <package> record (such as an <inferior-package>)
> or a package with a different name (like =E2=80=9Cdhcpcd-next=E2=80=9D), =
what about
> checking in the gexp which of /bin/dhclient and /bin/dhcpcd exists?

I think I haven't fully grasped G-Expressions yet. I do understand how
this would work inside the shepherd start gexp. However, I am not sure
how I would check if /bin/dhclient or /bin/dhcpcd exist in the package
within the dhcp-client-account-service since, at least as far as
I understand, the dhcp-client-account-service is itself not a gexp.

I think one could also argue that it might be preferable to check for
the package name as, just because a package provides /bin/dhclient,
doesn't necessarily mean that it is command-line compatible with the ISC
implementation. However, if you have any hints on updating the
account-service I would be willing to look into it.

> That sounds quite complex.  Surely there must be a way to force the name
> of the PID file or to determine its name without running dhcpcd in a
> pipe?

Unfortunately, I don't think there is any way to force the PID file
name. Furthermore, the pidfile path depends on the amount interfaces
specified. If there is only one interface, a single dhcpcd instance is
spawned and the pidfile refers to that. Otherwise, a management process
is started and the pidfile refers to the management process [1].

I think the best solution here would be to spawn dhcpcd as child process
of GNU shepherd and have shepherd supervise it that way. I have a service
doing that too, but its annoying to integrate with the existing dhclient
service [2]. Maybe that's something we can migrate to in the long run.

> Or leave it out entirely: I find it useful to have a DHCP client at hand
> just in case.  Thoughts?

I removed it, I agree that this change is best discussed separately.

> Could you send updated patches?

Apart from the two comments I discussed in greater detail above, I hope
I implemented all of your feedback as requested in the v3 revision of
this patchset. Please let me know if I missed anything.

Greetings
S=C3=B6ren

[1]: https://github.com/NetworkConfiguration/dhcpcd/blob/v10.0.6/src/dhcpcd=
.c#L2144
[2]: https://github.com/nmeum/guix-channel/blob/b1b80697a9d35ca015ce56ccf30=
31f91f2bf554f/src/nmeum/services/networking.scm#L130-L132




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 13 Feb 2024 12:51:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 13 07:51:20 2024
Received: from localhost ([127.0.0.1]:42886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rZsFr-00050p-K7
	for submit <at> debbugs.gnu.org; Tue, 13 Feb 2024 07:51:20 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:28727)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rZsFo-00050J-6l; Tue, 13 Feb 2024 07:51:18 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=+CVPgXe9o3
 3xj789ikQ62mSqjI1GBUVMXSMvJHRWfNQ=;
 h=references:in-reply-to:date:
 subject:to:from; d=soeren-tempel.net; b=WJ6bLMKdgz5blMy6PdW3/N3MLHc6w9
 lnDlXVoZ0Ios74NH78wOeCRkSrziBx2FMQTC3T9ZUq1sJoXxzbzj9EiWI3GHk4SdNXNaKT
 UATMXNu18SMIIJDxYIqG7QFw4ijfLMNlujEXJ5CjKONk/WFXneYV77Y2vWkXp6fl9GV0KD
 E=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-df49-33b7-2af2-ff52.310.pool.telefonica.de
 [2a02:3102:49da:1b:df49:33b7:2af2:ff52])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 43820bef
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 13 Feb 2024 13:50:55 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH v3 2/2] services: dhcp: Support the dhcpcd implementation.
Date: Tue, 13 Feb 2024 13:50:43 +0100
Message-ID: <bfd99f266c3fd749c6b24b386a7ac90dc89ce338.1707828643.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.1
In-Reply-To: <5c6f714f4802ec17bc247e701bcee82d54733005.1707828643.git.soeren@HIDDEN>
References: <5c6f714f4802ec17bc247e701bcee82d54733005.1707828643.git.soeren@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

Prior to this commit, the isc-dhcp implementation was the only DHCP
implementation supported by dhcp-client-shepherd-service. This is
problematic as the ISC implementation has reached end-of-life in
2022(!). As a first step to migrate away from isc-dhcp, this commit
adds support for dhcpcd to dhcp-client-shepherd-service. Currently,
it has to be enabled explicitly via the package field of the
dhcp-client-configuration. In the future, it is intended to become
the default to migrate away from isc-dhcp.

While at it, also remove isc-dhcp from %base-packages as it is no
longer necessarily needed and it will be pulled in by the DHCP
client service if required.

See also: https://issues.guix.gnu.org/68619

* gnu/services/networking.scm (dhcp-client-shepherd-service): Add
  support for the dhcpcd client implementation.
* gnu/services/networking.scm (dhcp-client-account-service): New
  procedure.
* gnu/services/networking.scm (dhcp-client-service-type): Add optional
  account-service-type extensions (needed for dhcpcd).
* gnu/system.scm (%base-packages-networking): Remove isc-dhcp from
  %base-packages (will be pulled in by dhcp-client-shepherd-service).

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
 gnu/services/networking.scm | 92 +++++++++++++++++++++++++++----------
 1 file changed, 67 insertions(+), 25 deletions(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 495d049728..4e058e1880 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -316,25 +316,21 @@ (define-record-type* <dhcp-client-configuration>
 (define dhcp-client-shepherd-service
   (match-lambda
     ((? dhcp-client-configuration? config)
-     (let ((package (dhcp-client-configuration-package config))
-           (requirement (dhcp-client-configuration-shepherd-requirement config))
-           (provision (dhcp-client-configuration-shepherd-provision config))
-           (interfaces (dhcp-client-configuration-interfaces config))
-           (pid-file "/var/run/dhclient.pid"))
+     (let* ((package (dhcp-client-configuration-package config))
+            (client-name (package-name package))
+            (requirement (dhcp-client-configuration-shepherd-requirement config))
+            (provision (dhcp-client-configuration-shepherd-provision config))
+            (interfaces (dhcp-client-configuration-interfaces config)))
        (list (shepherd-service
               (documentation "Set up networking via DHCP.")
               (requirement `(user-processes udev ,@requirement))
               (provision provision)
+              (modules `((ice-9 popen)
+                         (ice-9 rdelim)
+                         ,@%default-modules))
 
-              ;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when
-              ;; networking is unavailable, but also means that the interface is not up
-              ;; yet when 'start' completes.  To wait for the interface to be ready, one
-              ;; should instead monitor udev events.
               (start #~(lambda _
-                         (define dhclient
-                           (string-append #$package "/sbin/dhclient"))
-
-                         ;; When invoked without any arguments, 'dhclient' discovers all
+                         ;; When invoked without any arguments, the client discovers all
                          ;; non-loopback interfaces *that are up*.  However, the relevant
                          ;; interfaces are typically down at this point.  Thus we perform
                          ;; our own interface discovery here.
@@ -355,17 +351,46 @@ (define dhcp-client-shepherd-service
                                        (_
                                         #~'#$interfaces))))
 
-                         (false-if-exception (delete-file #$pid-file))
-                         (let ((pid (fork+exec-command
-                                     ;; By default dhclient uses a
-                                     ;; pre-standardization implementation of
-                                     ;; DDNS, which is incompatable with
-                                     ;; non-ISC DHCP servers; thus, pass '-I'.
-                                     ;; <https://kb.isc.org/docs/aa-01091>.
-                                     (cons* dhclient "-nw" "-I"
-                                            "-pf" #$pid-file ifaces))))
-                           (and (zero? (cdr (waitpid pid)))
-                                (read-pid-file #$pid-file)))))
+                         ;; Returns the execution configuration for the DHCP client
+                         ;; selected by the package field of dhcp-client-configuration.
+                         ;; The configuration is a pair of pidfile and execution command
+                         ;; where the latter is a list.
+                         (define exec-config
+                           (case (string->symbol #$client-name)
+                             ((isc-dhcp)
+                              (let ((pid-file "/var/run/dhclient.pid"))
+                                (cons
+                                  (cons* (string-append #$package "/sbin/dhclient")
+                                         "-nw" "-I" "-pf" pid-file ifaces)
+                                  pid-file)))
+                             ((dhcpcd)
+                              ;; For dhcpcd, the utilized pid-file depends on the
+                              ;; command-line arguments.  If multiple interfaces are
+                              ;; given, a different pid-file is returned.  Hence, we
+                              ;; consult dhcpcd itself to determine the pid-file.
+                              (let* ((cmd (string-append #$package "/sbin/dhcpcd"))
+                                     (arg (cons* cmd "-b" ifaces)))
+                                (cons arg
+                                  (let* ((pipe (string-join (append arg '("-P")) " "))
+                                         (port (open-input-pipe pipe))
+                                         (path (read-line port)))
+                                    (close-pipe port)
+                                    path))))
+                             (else
+                               (display
+                                 "unknown 'package' value in dhcp-client-configuration"
+                                 (current-error-port))
+                               (newline (current-error-port))
+                               #f)))
+
+                         (and
+                           exec-config
+                           (let ((pid-file (cdr exec-config))
+                                 (exec-cmd (car exec-config)))
+                             (false-if-exception (delete-file pid-file))
+                             (let ((pid (fork+exec-command exec-cmd)))
+                               (and (zero? (cdr (waitpid pid)))
+                                    (read-pid-file pid-file)))))))
               (stop #~(make-kill-destructor))))))
     (package
      (warning (G_ "'dhcp-client' service now expects a \
@@ -377,10 +402,27 @@ (define dhcp-client-shepherd-service
       (dhcp-client-configuration
        (package package))))))
 
+(define (dhcp-client-account-service config)
+  (let ((package (dhcp-client-configuration-package config)))
+    ;; Contrary to other DHCP clients (e.g. dhclient), dhcpcd supports
+    ;; privilege separation.  Hence, we need to create an account here.
+    (if (string=? "dhcpcd" (package-name package))
+      (list (user-group (name "dhcpcd") (system? #t))
+            (user-account
+              (name "dhcpcd")
+              (group "dhcpcd")
+              (system? #t)
+              (comment "dhcpcd daemon user")
+              (home-directory "/var/empty")
+              (shell "/run/current-system/profile/sbin/nologin")))
+      '())))
+
 (define dhcp-client-service-type
   (service-type (name 'dhcp-client)
                 (extensions
-                 (list (service-extension shepherd-root-service-type
+                 (list (service-extension account-service-type
+                                          dhcp-client-account-service)
+                       (service-extension shepherd-root-service-type
                                           dhcp-client-shepherd-service)))
                 (default-value (dhcp-client-configuration))
                 (description "Run @command{dhcp}, a Dynamic Host Configuration




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 13 Feb 2024 12:51:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 13 07:51:17 2024
Received: from localhost ([127.0.0.1]:42884 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rZsFo-00050W-Sh
	for submit <at> debbugs.gnu.org; Tue, 13 Feb 2024 07:51:17 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:28727)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rZsFm-00050J-Mz; Tue, 13 Feb 2024 07:51:15 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=vCjyX2Vtq8
 1UM0idzjJ918bbbP9Iqua5Ff/9KBI6KXQ=; h=date:subject:to:from;
 d=soeren-tempel.net; b=lK8xhgS3wTVj7Iq6yF6VCU05UQn+XOLwcffeYOYY9kPDdRT
 dZHZOpdTIh0wBrx3HplRUWcKt/jSlh6LgTlQEmqgwVjIub32QM+l2pUqNfAvHeLQruuhst
 Tu4mWmGFFGFDkhEqYnHaSO2P55K/3PLx8P9W/UBoJuEZnm68Bzioto=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-df49-33b7-2af2-ff52.310.pool.telefonica.de
 [2a02:3102:49da:1b:df49:33b7:2af2:ff52])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 4c07c2c4
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 13 Feb 2024 13:50:54 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH v3 1/2] gnu: Add dhcpcd.
Date: Tue, 13 Feb 2024 13:50:42 +0100
Message-ID: <5c6f714f4802ec17bc247e701bcee82d54733005.1707828643.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

* gnu/packages/admin.scm (dhcpcd): new procedure.

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
 gnu/packages/admin.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index fcf05992d8..efd374fe5a 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1608,6 +1608,62 @@ (define-public isc-dhcp
       (license license:mpl2.0)
       (properties '((cpe-name . "dhcp"))))))
 
+(define-public dhcpcd
+  (package
+    (name "dhcpcd")
+    (version "10.0.6")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/NetworkConfiguration/dhcpcd")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
+       (file-name (git-file-name name version))))
+    (inputs (list bash-minimal))
+    (native-inputs (list eudev))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:test-target "test"
+      #:configure-flags #~(list "--enable-ipv6"
+                                "--enable-privsep"
+                                "--privsepuser=dhcpcd"
+                                (string-append "--dbdir=" "/var/db/dhcpcd")
+                                (string-append "--rundir=" "/var/run/dhcpcd")
+                                (string-append "CC=" #$(cc-for-target)))
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'do-not-create-dbdir
+                     (lambda _
+                       ;; Make sure that the Makefile doesn't attempt to create
+                       ;; /var/db/dhcpcd for which it doesn't have permissions.
+                       (substitute* "src/Makefile"
+                         (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}")
+                          ""))))
+                   (add-before 'build 'setenv
+                     (lambda _
+                       (setenv "HOST_SH" (which "sh"))))
+                   (add-after 'install 'wrap-hooks
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (libexec (string-append out "/libexec"))
+                              (sed (search-input-file inputs "/bin/sed"))
+                              (rm (search-input-file inputs "/bin/rm")))
+                         (wrap-program (string-append libexec
+                                                      "/dhcpcd-run-hooks")
+                           `("PATH" ":" suffix
+                             (,(dirname sed)
+                              ,(dirname rm))))))))))
+    (home-page "https://roy.marples.name/projects/dhcpcd")
+    (synopsis "Feature-rich DHCP and DHCPv6 client")
+    (description
+     "Provides a DHCP and a DHCPv6 client.  Additionally,
+dhcpcd is also an IPv4LL (aka ZeroConf) client.  In layperson's terms,
+dhcpcd runs on your machine and silently configures your computer to work
+on the attached networks without trouble and mostly without configuration.")
+    (license license:bsd-2)))
+
 (define-public radvd
   (package
     (name "radvd")

base-commit: 29c26a8d308286cf378ce9cfa3d73e3d1454263d




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 12 Feb 2024 21:42:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 12 16:42:12 2024
Received: from localhost ([127.0.0.1]:33464 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rZe43-000173-Fi
	for submit <at> debbugs.gnu.org; Mon, 12 Feb 2024 16:42:12 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:39584)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1rZe40-00016K-KT
 for 68675 <at> debbugs.gnu.org; Mon, 12 Feb 2024 16:42:09 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1rZe3d-0003jq-KB; Mon, 12 Feb 2024 16:41:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=5nqP8feMrHaSDeo94RhuAIDEmse/4AoRGnrxtoql9OQ=; b=HvWkqRpoFjEMXMwfMjX1
 Zq3rThIbZwmp10h2sWzAbNZRCpHf0HjOrt9Ix7M7I2TJAHo0ynHViinztWqKoT5wzsZXLmZIZ2Fze
 54PYY6Jz5Hi4S+Q/vjxFeSyO3dX2PxK+64HIBuNAMhOuPM1xkHhU9Gjj97AIbetoNeikbyWIrjdo8
 fbEmtsvI3cLfMAZBQejilbrN4mLDNcnd2j4XugS5LDvmj1biDCLkWMrOrNK3Mkoa3Z5VkAznmKFNB
 9RbIvp7sD8AOO2034XWGM2v9Po8DZLO7TopQ20m9nkdn55zxuZE83qJ8rC06qbjymWFYNuE/v7t9h
 CYEZe9MDjgB+YA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: soeren@HIDDEN
Subject: Re: [bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd
 implementation.
In-Reply-To: <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@HIDDEN>
 (soeren@HIDDEN's message of "Wed, 24 Jan 2024 20:05:13
 +0100")
References: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
 <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@HIDDEN>
Date: Mon, 12 Feb 2024 22:41:42 +0100
Message-ID: <87ttmdbbs9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

soeren@HIDDEN skribis:

> From: S=C3=B6ren Tempel <soeren@HIDDEN>
>
> Prior to this commit, the isc-dhcp implementation was the only DHCP
> implementation supported by dhcp-client-shepherd-service. This is
> problematic as the ISC implementation has reached end-of-life in
> 2022(!). As a first step to migrate away from isc-dhcp, this commit
> adds support for dhcpcd to dhcp-client-shepherd-service. Currently,
> it has to be enabled explicitly via the package field of the
> dhcp-client-configuration. In the future, it is intended to become
> the default to migrate away from isc-dhcp.
>
> While at it, also remove isc-dhcp from %base-packages as it is no
> longer necessarily needed and it will be pulled in by the DHCP
> client service if required.
>
> See also: https://issues.guix.gnu.org/68619
>
> * gnu/services/networking.scm (dhcp-client-shepherd-service): Add
>   support for the dhcpcd client implementation.
> * gnu/services/networking.scm (dhcp-client-account-service): New
>   procedure.
> * gnu/services/networking.scm (dhcp-client-service-type): Add optional
>   account-service-type extensions (needed for dhcpcd).
> * gnu/system.scm (%base-packages-networking): Remove isc-dhcp from
>   %base-packages (will be pulled in by dhcp-client-shepherd-service).
>
> Signed-off-by: S=C3=B6ren Tempel <soeren@HIDDEN>

Much welcome improvement!

Some comments:

> +     (let* ((package (dhcp-client-configuration-package config))
> +            (client-name (package-name package))
> +            (requirement (dhcp-client-configuration-shepherd-requirement=
 config))
> +            (provision (dhcp-client-configuration-shepherd-provision con=
fig))
> +            (interfaces (dhcp-client-configuration-interfaces config)))

Instead of calling =E2=80=98package-name=E2=80=99, which would prevent the =
use of
something other than a <package> record (such as an <inferior-package>)
or a package with a different name (like =E2=80=9Cdhcpcd-next=E2=80=9D), wh=
at about
checking in the gexp which of /bin/dhclient and /bin/dhcpcd exists?

>                (start #~(lambda _
> -                         (define dhclient
> -                           (string-append #$package "/sbin/dhclient"))
> +                         (use-modules (ice-9 popen)
> +                                      (ice-9 rdelim))

Instead of =E2=80=98use-modules=E2=80=99 within a function, which has ill-d=
efined
semantics, add a =E2=80=98modules=E2=80=99 field to the =E2=80=98shepherd-s=
ervice=E2=80=99 form.

> +                         ;; Returns the execution configuration for the =
DHCP client
> +                         ;; selected by the package field of dhcp-client=
-configuration.
> +                         ;; The configuration is a pair of pidfile and e=
xecution command
> +                         ;; where the latter is a list.
> +                         (define exec-config
> +                           (case (string->symbol #$client-name)
> +                             ((isc-dhcp)
> +                              (let ((pid-file "/var/run/dhclient.pid"))
> +                                (cons
> +                                  (cons* (string-append #$package "/sbin=
/dhclient")
> +                                         "-nw" "-I" "-pf" pid-file iface=
s)
> +                                  pid-file)))
> +                             ((dhcpcd)
> +                              ;; For dhcpcd, the utilized pid-file depen=
ds on the
> +                              ;; command-line arguments.  If multiple in=
terfaces are
> +                              ;; given, a different pid-file is returned=
.  Hence, we
> +                              ;; consult dhcpcd itself to determine the =
pid-file.
> +                              (let* ((cmd (string-append #$package "/sbi=
n/dhcpcd"))
> +                                     (arg (cons* cmd "-b" ifaces)))
> +                                (cons arg
> +                                  (let* ((pipe (string-join (append arg =
'("-P")) " "))
> +                                         (port (open-input-pipe pipe))
> +                                         (path (read-line port)))
> +                                    (close-pipe port)
> +                                    path))))

That sounds quite complex.  Surely there must be a way to force the name
of the PID file or to determine its name without running dhcpcd in a
pipe?

> +                             (else
> +                               (error (G_ "unknown 'package' value in dh=
cp-client-configuration")))))

=E2=80=98G_=E2=80=99 here is undefined, a =E2=80=98error=E2=80=99 doesn=E2=
=80=99t do what you perhaps think it
does (it throws to =E2=80=98misc-error=E2=80=99).

Instead, I would just print a message to the current error port (it=E2=80=
=99ll
be logged) and have =E2=80=98start=E2=80=99 return #f, meaning that the ser=
vice failed
to start.
> +++ b/gnu/system.scm
> @@ -917,7 +917,7 @@ (define %base-packages-interactive
>=20=20
>  (define %base-packages-networking
>    ;; Default set of networking packages.
> -  (list inetutils isc-dhcp
> +  (list inetutils

I would leave this change for a separate patch.

Or leave it out entirely: I find it useful to have a DHCP client at hand
just in case.  Thoughts?

Could you send updated patches?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 12 Feb 2024 21:40:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 12 16:40:23 2024
Received: from localhost ([127.0.0.1]:33318 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rZe2I-0000xi-Gh
	for submit <at> debbugs.gnu.org; Mon, 12 Feb 2024 16:40:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57592)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1rZdvV-0000GO-3H
 for 68675 <at> debbugs.gnu.org; Mon, 12 Feb 2024 16:33:22 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1rZdv7-0002IX-2H; Mon, 12 Feb 2024 16:32:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=x9EK7xv7Fqfdaan68f3JxWOrY5Bwo5XdmQkw5Icrc18=; b=MVcNWoq6F0UGm4Ag3YT5
 nmJkJ+KTdoGQZurHhiFk8C6CShOvM1aPXdD51xRJXfOOt1mnhsLImHFq76l0UfL0QHFfW3TLfloXj
 Zjrz7cE6PedW94eOD6RVFeLb+h6jpi+hNBHV36JlDRrRNjVT01VB9UTFa/lA/NtWabD5B2/wyECvA
 Sl/Wh4a97KtUJo3m4cGrnanuqFoA5yB4Mu7USJNn4oagnFMjdGDOAtl/YuSzwO+qfNGmzgHSLj0Jl
 EV0WxzJMxuUKXfgXlCvYKQ7lbQoD2G42PhYdxIztIyi0/XkJJpCdZQxCHTcKzwxmj7gxTc78lv2LE
 umNvEK2FklJjIQ==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: soeren@HIDDEN
Subject: Re: [bug#68675] [PATCH v2] gnu: Add dhcpcd.
In-Reply-To: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
 (soeren@HIDDEN's message of "Wed, 24 Jan 2024 20:05:11
 +0100")
References: <cover.1706026000.git.soeren@HIDDEN>
 <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
Date: Mon, 12 Feb 2024 22:32:52 +0100
Message-ID: <87y1bpbc6z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

soeren@HIDDEN skribis:

> From: S=C3=B6ren Tempel <soeren@HIDDEN>
>
> * gnu/packages/admin.scm (dhcpcd): new procedure.
>
> Signed-off-by: S=C3=B6ren Tempel <soeren@HIDDEN>

Overall LGTM modulo minor stylistic issues:

> +      #:configure-flags #~(list "--enable-ipv6"
> +                                "--enable-privsep"
> +                                "--privsepuser=3Ddhcpcd"
> +                                (string-append "--dbdir=3D" "/var/db/dhc=
pcd")
> +                                (string-append "--rundir=3D" "/var/run/d=
hcpcd")
> +                                "CC=3Dgcc")

Should be (string-append "CC=3D" #$(cc-for-target)).

> +                   (add-before 'build 'setenv
> +                     (lambda _
> +                       (setenv "HOST_SH"
> +                               (string-append #$bash-minimal "/bin/sh"))=
))

Rather (setenv "HOST_SH" (which "sh")).

That way users can still override the shell used by the package.

> +                   (add-after 'install 'wrap-hooks
> +                     (lambda* (#:key inputs outputs #:allow-other-keys)
> +                       (let* ((out (assoc-ref outputs "out"))
> +                              (libexec (string-append out "/libexec"))
> +                              (sed (assoc-ref inputs "sed"))
> +                              (coreutils (assoc-ref inputs "coreutils")))

Rather (search-input-file inputs "/bin/sed") and likewise for coreutils,
and then=E2=80=A6

> +                         (wrap-program (string-append libexec
> +                                                      "/dhcpcd-run-hooks=
")
> +                           `("PATH" ":" suffix
> +                             (,(string-append coreutils "/bin")
> +                              ,(string-append sed "/bin"))))))))))

=E2=80=A6 use (dirname sed) and (dirname ls), say, to get their /bin direct=
ory.

This is more robust than relying on the input label.

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 24 Jan 2024 19:11:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 24 14:11:55 2024
Received: from localhost ([127.0.0.1]:46594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSifD-0000qn-3Y
	for submit <at> debbugs.gnu.org; Wed, 24 Jan 2024 14:11:55 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:32174)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1rSifB-0000qf-7O
 for 68675 <at> debbugs.gnu.org; Wed, 24 Jan 2024 14:11:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=OTXkxLinF3
 LBesM1fKYzmo8ksgegc8YN2ix7j7wZH0M=;
 h=in-reply-to:references:from:
 subject:cc:to:date; d=soeren-tempel.net; b=G4h2uG8WnLY7JxHCV39YRQ64aEc
 kuxcOhwnsuYlDHlT3c5l+5X63nlnngLBLowjn7ieRM/rZri6Z4nG0b5WIGv8ykyo34A0VC
 aK9hKqZ0pXvOL9IGSCDV0hi/jzhQiTnlsEfDSYlrTRyIOncqPiG+Owr4GtJhh9wkx1q0tV
 3auY=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-a26a-e6c8-9697-b50f.310.pool.telefonica.de
 [2a02:3102:49da:1b:a26a:e6c8:9697:b50f])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id ae82fff4
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Wed, 24 Jan 2024 20:11:47 +0100 (CET)
Date: Wed, 24 Jan 2024 20:11:46 +0100
To: Sergey Trofimov <sarg@HIDDEN>
Subject: Re: [bug#68675] [PATCH] Support dhcpcd in dhcp-client-service-type
From: =?UTF-8?Q?S=C3=B6ren?= Tempel <soeren@HIDDEN>
References: <cover.1706026000.git.soeren@HIDDEN>
 <87zfwvyghg.fsf@HIDDEN>
In-Reply-To: <87zfwvyghg.fsf@HIDDEN>
Message-Id: <35004A3C7FWLY.2YGLY8PSSS0H5@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Hi Sergey,

Sergey Trofimov <sarg@HIDDEN> wrote:
> Basic functionality works for me - my laptop receives an address.

Great, thanks for your feedback!

> Some things to fix:
> 1. 20-resolv.conf hook needs to be wrapped, it can't find `resolvconf`
> currently (from openresolv)

Good catch, it does need to be wrapped. However, it doesn't need
resolvconf (that's just an optional dependency) it does, however, need
coreutils and sed. I added a corresponding wrap-program invocation.

This should fix creation of /etc/resolv.conf via dhcpcd.

> 2. %base-packages still contains isc-dhcp... why is it even needed?

I removed it from %base-packages together with the service changes.

Let me know if you find anything else!

Greetings
S=C3=B6ren




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 24 Jan 2024 19:07:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 24 14:07:47 2024
Received: from localhost ([127.0.0.1]:46581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSibD-0000kO-0g
	for submit <at> debbugs.gnu.org; Wed, 24 Jan 2024 14:07:47 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:6429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rSibA-0000kF-9z; Wed, 24 Jan 2024 14:07:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=AEE2kL6maT
 2l8IYJpzF+ET0FejjYFPGKlkYKRWcHyBc=;
 h=references:in-reply-to:date:
 subject:to:from; d=soeren-tempel.net; b=RfdCZ4Fulz5aQPEPVTYUck9LPkIKLF
 IQ5LgYPAIpUFz7rBEbF1HuXBcg4HZA0rAEM9MA2N7sLoRQnZ3CfmzkX6J3K6vU35aixzxF
 PCgNEgR5GFcpprGehR66J3R/tBq/vgYQhQqGbGbU0V7Yqk+pF+S5W8wigbZ/lbYEh98uX1
 I=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-a26a-e6c8-9697-b50f.310.pool.telefonica.de
 [2a02:3102:49da:1b:a26a:e6c8:9697:b50f])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 66f70464
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Wed, 24 Jan 2024 20:07:38 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH v2] services: dhcp: Support the dhcpcd implementation.
Date: Wed, 24 Jan 2024 20:05:13 +0100
Message-ID: <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
References: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

Prior to this commit, the isc-dhcp implementation was the only DHCP
implementation supported by dhcp-client-shepherd-service. This is
problematic as the ISC implementation has reached end-of-life in
2022(!). As a first step to migrate away from isc-dhcp, this commit
adds support for dhcpcd to dhcp-client-shepherd-service. Currently,
it has to be enabled explicitly via the package field of the
dhcp-client-configuration. In the future, it is intended to become
the default to migrate away from isc-dhcp.

While at it, also remove isc-dhcp from %base-packages as it is no
longer necessarily needed and it will be pulled in by the DHCP
client service if required.

See also: https://issues.guix.gnu.org/68619

* gnu/services/networking.scm (dhcp-client-shepherd-service): Add
  support for the dhcpcd client implementation.
* gnu/services/networking.scm (dhcp-client-account-service): New
  procedure.
* gnu/services/networking.scm (dhcp-client-service-type): Add optional
  account-service-type extensions (needed for dhcpcd).
* gnu/system.scm (%base-packages-networking): Remove isc-dhcp from
  %base-packages (will be pulled in by dhcp-client-shepherd-service).

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
Changes since v1:

* Remove isc-dhcp from %base-packages

 gnu/services/networking.scm | 84 ++++++++++++++++++++++++++-----------
 gnu/system.scm              |  2 +-
 2 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 495d049728..3621e2bda2 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -316,25 +316,21 @@ (define-record-type* <dhcp-client-configuration>
 (define dhcp-client-shepherd-service
   (match-lambda
     ((? dhcp-client-configuration? config)
-     (let ((package (dhcp-client-configuration-package config))
-           (requirement (dhcp-client-configuration-shepherd-requirement config))
-           (provision (dhcp-client-configuration-shepherd-provision config))
-           (interfaces (dhcp-client-configuration-interfaces config))
-           (pid-file "/var/run/dhclient.pid"))
+     (let* ((package (dhcp-client-configuration-package config))
+            (client-name (package-name package))
+            (requirement (dhcp-client-configuration-shepherd-requirement config))
+            (provision (dhcp-client-configuration-shepherd-provision config))
+            (interfaces (dhcp-client-configuration-interfaces config)))
        (list (shepherd-service
               (documentation "Set up networking via DHCP.")
               (requirement `(user-processes udev ,@requirement))
               (provision provision)
 
-              ;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when
-              ;; networking is unavailable, but also means that the interface is not up
-              ;; yet when 'start' completes.  To wait for the interface to be ready, one
-              ;; should instead monitor udev events.
               (start #~(lambda _
-                         (define dhclient
-                           (string-append #$package "/sbin/dhclient"))
+                         (use-modules (ice-9 popen)
+                                      (ice-9 rdelim))
 
-                         ;; When invoked without any arguments, 'dhclient' discovers all
+                         ;; When invoked without any arguments, the client discovers all
                          ;; non-loopback interfaces *that are up*.  However, the relevant
                          ;; interfaces are typically down at this point.  Thus we perform
                          ;; our own interface discovery here.
@@ -355,17 +351,40 @@ (define dhcp-client-shepherd-service
                                        (_
                                         #~'#$interfaces))))
 
-                         (false-if-exception (delete-file #$pid-file))
-                         (let ((pid (fork+exec-command
-                                     ;; By default dhclient uses a
-                                     ;; pre-standardization implementation of
-                                     ;; DDNS, which is incompatable with
-                                     ;; non-ISC DHCP servers; thus, pass '-I'.
-                                     ;; <https://kb.isc.org/docs/aa-01091>.
-                                     (cons* dhclient "-nw" "-I"
-                                            "-pf" #$pid-file ifaces))))
-                           (and (zero? (cdr (waitpid pid)))
-                                (read-pid-file #$pid-file)))))
+                         ;; Returns the execution configuration for the DHCP client
+                         ;; selected by the package field of dhcp-client-configuration.
+                         ;; The configuration is a pair of pidfile and execution command
+                         ;; where the latter is a list.
+                         (define exec-config
+                           (case (string->symbol #$client-name)
+                             ((isc-dhcp)
+                              (let ((pid-file "/var/run/dhclient.pid"))
+                                (cons
+                                  (cons* (string-append #$package "/sbin/dhclient")
+                                         "-nw" "-I" "-pf" pid-file ifaces)
+                                  pid-file)))
+                             ((dhcpcd)
+                              ;; For dhcpcd, the utilized pid-file depends on the
+                              ;; command-line arguments.  If multiple interfaces are
+                              ;; given, a different pid-file is returned.  Hence, we
+                              ;; consult dhcpcd itself to determine the pid-file.
+                              (let* ((cmd (string-append #$package "/sbin/dhcpcd"))
+                                     (arg (cons* cmd "-b" ifaces)))
+                                (cons arg
+                                  (let* ((pipe (string-join (append arg '("-P")) " "))
+                                         (port (open-input-pipe pipe))
+                                         (path (read-line port)))
+                                    (close-pipe port)
+                                    path))))
+                             (else
+                               (error (G_ "unknown 'package' value in dhcp-client-configuration")))))
+
+                         (let ((pid-file (cdr exec-config))
+                               (exec-cmd (car exec-config)))
+                           (false-if-exception (delete-file pid-file))
+                           (let ((pid (fork+exec-command exec-cmd)))
+                             (and (zero? (cdr (waitpid pid)))
+                                  (read-pid-file pid-file))))))
               (stop #~(make-kill-destructor))))))
     (package
      (warning (G_ "'dhcp-client' service now expects a \
@@ -377,10 +396,27 @@ (define dhcp-client-shepherd-service
       (dhcp-client-configuration
        (package package))))))
 
+(define (dhcp-client-account-service config)
+  (let ((package (dhcp-client-configuration-package config)))
+    ;; Contrary to other DHCP clients (e.g. dhclient), dhcpcd supports
+    ;; privilege separation.  Hence, we need to create an account here.
+    (if (string=? "dhcpcd" (package-name package))
+      (list (user-group (name "dhcpcd") (system? #t))
+            (user-account
+              (name "dhcpcd")
+              (group "dhcpcd")
+              (system? #t)
+              (comment "dhcpcd daemon user")
+              (home-directory "/var/empty")
+              (shell "/run/current-system/profile/sbin/nologin")))
+      '())))
+
 (define dhcp-client-service-type
   (service-type (name 'dhcp-client)
                 (extensions
-                 (list (service-extension shepherd-root-service-type
+                 (list (service-extension account-service-type
+                                          dhcp-client-account-service)
+                       (service-extension shepherd-root-service-type
                                           dhcp-client-shepherd-service)))
                 (default-value (dhcp-client-configuration))
                 (description "Run @command{dhcp}, a Dynamic Host Configuration
diff --git a/gnu/system.scm b/gnu/system.scm
index 3cd64a5c9f..a7676ec90e 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -917,7 +917,7 @@ (define %base-packages-interactive
 
 (define %base-packages-networking
   ;; Default set of networking packages.
-  (list inetutils isc-dhcp
+  (list inetutils
         iproute
         wget
         ;; wireless-tools is deprecated in favor of iw, but it's still what




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 24 Jan 2024 19:07:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 24 14:07:23 2024
Received: from localhost ([127.0.0.1]:46578 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSiao-0000jm-Gy
	for submit <at> debbugs.gnu.org; Wed, 24 Jan 2024 14:07:22 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:12756)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rSial-0000jc-1m; Wed, 24 Jan 2024 14:07:20 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=LufFgN74cH
 J38lt5iLKazRIUm9JIsx94xPzGa3pdaA8=; h=date:subject:to:from;
 d=soeren-tempel.net; b=glmvWk/kcLlsYFfdcH58bnv0aogs33h6Wm2LzfKs9r23FIU
 8t067OoUqbESSt9A+Ku6TlKrI5f6TdtgAr7h31xHR/Og+17+RvMQZV2186318Z4eogCdB8
 VReek3jOYrmuzY+XrYqieTQXw++wF0gKfUYuFrErSZQnxCXKZmFHZo=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-a26a-e6c8-9697-b50f.310.pool.telefonica.de
 [2a02:3102:49da:1b:a26a:e6c8:9697:b50f])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 99597a9e
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Wed, 24 Jan 2024 20:07:11 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH v2] gnu: Add dhcpcd.
Date: Wed, 24 Jan 2024 20:05:11 +0100
Message-ID: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

* gnu/packages/admin.scm (dhcpcd): new procedure.

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
Change since v1:

* wrap dhcpcd-run-hooks to make sed and coreutils available
* fix various lint and style warnings for the dhcpcd package

 gnu/packages/admin.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index fcf05992d8..4b106f87a8 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1608,6 +1608,63 @@ (define-public isc-dhcp
       (license license:mpl2.0)
       (properties '((cpe-name . "dhcp"))))))
 
+(define-public dhcpcd
+  (package
+    (name "dhcpcd")
+    (version "10.0.6")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/NetworkConfiguration/dhcpcd")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
+       (file-name (git-file-name name version))))
+    (inputs (list bash-minimal))
+    (native-inputs (list eudev))
+    (build-system gnu-build-system)
+    (arguments
+     (list
+      #:test-target "test"
+      #:configure-flags #~(list "--enable-ipv6"
+                                "--enable-privsep"
+                                "--privsepuser=dhcpcd"
+                                (string-append "--dbdir=" "/var/db/dhcpcd")
+                                (string-append "--rundir=" "/var/run/dhcpcd")
+                                "CC=gcc")
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'do-not-create-dbdir
+                     (lambda _
+                       ;; Make sure that the Makefile doesn't attempt to create
+                       ;; /var/db/dhcpcd for which it doesn't have permissions.
+                       (substitute* "src/Makefile"
+                         (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}")
+                          ""))))
+                   (add-before 'build 'setenv
+                     (lambda _
+                       (setenv "HOST_SH"
+                               (string-append #$bash-minimal "/bin/sh"))))
+                   (add-after 'install 'wrap-hooks
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (libexec (string-append out "/libexec"))
+                              (sed (assoc-ref inputs "sed"))
+                              (coreutils (assoc-ref inputs "coreutils")))
+                         (wrap-program (string-append libexec
+                                                      "/dhcpcd-run-hooks")
+                           `("PATH" ":" suffix
+                             (,(string-append coreutils "/bin")
+                              ,(string-append sed "/bin"))))))))))
+    (home-page "https://roy.marples.name/projects/dhcpcd")
+    (synopsis "Feature-rich DHCP and DHCPv6 client")
+    (description
+     "Provides a DHCP and a DHCPv6 client.  Additionally,
+dhcpcd is also an IPv4LL (aka ZeroConf) client.  In layperson's terms,
+dhcpcd runs on your machine and silently configures your computer to work
+on the attached networks without trouble and mostly without configuration.")
+    (license license:bsd-2)))
+
 (define-public radvd
   (package
     (name "radvd")

base-commit: 29c26a8d308286cf378ce9cfa3d73e3d1454263d




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 23 Jan 2024 19:53:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 23 14:52:59 2024
Received: from localhost ([127.0.0.1]:44021 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSMpO-0000pL-GX
	for submit <at> debbugs.gnu.org; Tue, 23 Jan 2024 14:52:59 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:48459)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1rSMpL-0000p7-IV
 for 68675 <at> debbugs.gnu.org; Tue, 23 Jan 2024 14:52:57 -0500
Received: by mail-wm1-x32f.google.com with SMTP id
 5b1f17b1804b1-40eacb4bfa0so27265115e9.1
 for <68675 <at> debbugs.gnu.org>; Tue, 23 Jan 2024 11:52:50 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1706039565; x=1706644365; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=md9/K1d/ChXJuUU6EkHLJjkt/ugchhYsQdRvzdRF9YA=;
 b=iGxXaphYaTE4DFm04CFxXLDexsftRgPZKSFKUrbZdsrZyDOI/swP6zhETRrZ9l+YLV
 z6cGDdzt+if8cbjABkPd7/stDjiS7CPDrbBkXFXHEvKkWjttvDZaUffbrKj5Z32zpmtI
 ACpsT6IEiQv97EPviXsslJ2U1HQDIUgP33eDw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1706039565; x=1706644365;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=md9/K1d/ChXJuUU6EkHLJjkt/ugchhYsQdRvzdRF9YA=;
 b=k/b1KLQD4RIqVa8Sq3EP4lo0kEb1yDdt6zr7qaV/V9eI1iHfKTba1xe0WCgdP0tlOH
 ogjfuu13HbzRiYqdzISkTmUcfLDGve/MbVomWshWPckFM7tYJnDbOGhYUia1K5W6vW/P
 mSf95t9ZzhT4c3GLQzVYwEiYvAogSqw9wYMgaOfZRxP1QT5aLiZSzKaUnfIaLfg+EKYB
 IMpGstNeoUi86G8opItWnVlzJsjALd0fqEK0X5Zg7Cq7B4n6SpKUgC0z8MCQ7HCK6S5a
 qhQSbTxtFOAbeCYEoPYxPLDjU6PMU3anRaQhRTl3hX5aXkyXW53qjl0LV+qJAF3o40Br
 TTCA==
X-Gm-Message-State: AOJu0YzkE0vasnJ+AAxh0fO6BJL81iZJwz6Wi7GYGceTEhezYNK0ryom
 BW2WQ1ETxABMURA2QklsPFFElscsUZ+5NR9kU/s4lRQHtV9vo+VSFFkbznIGZYlBnro7If5waCh
 4OEA=
X-Google-Smtp-Source: AGHT+IHPA20qnDvypsmbjAJ0dcNEz8WMmhoBChEHX84oh6cf/t7tYQTwKsH2RmhhJ+6O8HWbq6kORg==
X-Received: by 2002:a05:600c:3d11:b0:40e:c341:5f88 with SMTP id
 bh17-20020a05600c3d1100b0040ec3415f88mr320860wmb.118.1706039564743; 
 Tue, 23 Jan 2024 11:52:44 -0800 (PST)
Received: from localhost ([2a02:2454:a09d:d000:3f1e:a87:ccd2:4aec])
 by smtp.gmail.com with ESMTPSA id
 o21-20020a05600c4fd500b0040e34ca648bsm43626049wmq.0.2024.01.23.11.52.44
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 23 Jan 2024 11:52:44 -0800 (PST)
From: Sergey Trofimov <sarg@HIDDEN>
X-Google-Original-From: Sergey Trofimov
 <sarg@HIDDEN>
To: soeren@HIDDEN
Subject: Re: [bug#68675] [PATCH] Support dhcpcd in dhcp-client-service-type
In-Reply-To: <cover.1706026000.git.soeren@HIDDEN>
 (soeren@HIDDEN's message of "Tue, 23 Jan 2024 17:12:43 +0100")
References: <cover.1706026000.git.soeren@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Date: Tue, 23 Jan 2024 20:52:43 +0100
Message-ID: <87zfwvyghg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: 68675
Cc: 68675 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

soeren@HIDDEN writes:

> Specifically, this patch series adds support for dhcpcd. However, it
> is not yet enabled by default. Nonetheless, I would strongly suggest
> enabling it by default at a later point in time.
>
> In order to enable dhcpcd add the following to /etc/config.scm:
>
> 	(service dhcp-client-service-type
> 	         (dhcp-client-configuration
> 	           (package dhcpcd)))
>
> I have done some basics tests with this change applied with both
> dhcpcd and isc-dhcp. Further tests and feedback would be much
> appreciated!
>

Basic functionality works for me - my laptop receives an address.

Some things to fix:
1. 20-resolv.conf hook needs to be wrapped, it can't find `resolvconf`
currently (from openresolv)
2. %base-packages still contains isc-dhcp... why is it even needed?




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 23 Jan 2024 16:15:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 23 11:15:23 2024
Received: from localhost ([127.0.0.1]:43833 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSJQo-00030j-Ty
	for submit <at> debbugs.gnu.org; Tue, 23 Jan 2024 11:15:23 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:32325)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rSJQj-00030B-Cf; Tue, 23 Jan 2024 11:15:18 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=wvHlj9PHrj
 9/m2osIm/SRuthX1y/0oGY2Y7OedtfoAk=;
 h=references:in-reply-to:date:
 subject:to:from; d=soeren-tempel.net; b=uKOQuTV/kOqGMdr8EVsXc8YZYbiLtc
 O7pNmFYIz1NN5/MPbafne/e4vyxO+lgT1l1AN3eXjkbGVKjzFdlXeBEnp9KPehUMMxoLTJ
 PUbfd+/6NFk7uKl42mfN0C/ss9uLiKCilWAh2L8XRgHyzIIRZ9KcPQF5ZORap87cN9JxYJ
 w=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-1300-cfa0-a067-980d.310.pool.telefonica.de
 [2a02:3102:49da:1b:1300:cfa0:a067:980d])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id c4e14895
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 23 Jan 2024 17:15:11 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH] services: dhcp: Support the dhcpcd implementation.
Date: Tue, 23 Jan 2024 17:14:56 +0100
Message-ID: <68f1b45a7f8ced9bb57c661c0e7afa5136b5c673.1706026000.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1706026000.git.soeren@HIDDEN>
References: <cover.1706026000.git.soeren@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

Prior to this commit, the isc-dhcp implementation was the only DHCP
implementation supported by dhcp-client-shepherd-service. This is
problematic as the ISC implementation has reached end-of-life in
2022(!). As a first step to migrate away from isc-dhcp, this commit
adds support for dhcpcd to dhcp-client-shepherd-service. Currently,
it has to be enabled explicitly via the package field of the
dhcp-client-configuration. In the future, it is intended to become
the default to migrate away from isc-dhcp.

See also: https://issues.guix.gnu.org/68619

* gnu/services/networking.scm (dhcp-client-shepherd-service): Add
  support for the dhcpcd client implementation.
* gnu/services/networking.scm (dhcp-client-account-service): New
  procedure.
* gnu/services/networking.scm (dhcp-client-service-type): Add optional
  account-service-type extensions (needed for dhcpcd).

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
 gnu/services/networking.scm | 84 ++++++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 24 deletions(-)

diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 495d049728..3621e2bda2 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -316,25 +316,21 @@ (define-record-type* <dhcp-client-configuration>
 (define dhcp-client-shepherd-service
   (match-lambda
     ((? dhcp-client-configuration? config)
-     (let ((package (dhcp-client-configuration-package config))
-           (requirement (dhcp-client-configuration-shepherd-requirement config))
-           (provision (dhcp-client-configuration-shepherd-provision config))
-           (interfaces (dhcp-client-configuration-interfaces config))
-           (pid-file "/var/run/dhclient.pid"))
+     (let* ((package (dhcp-client-configuration-package config))
+            (client-name (package-name package))
+            (requirement (dhcp-client-configuration-shepherd-requirement config))
+            (provision (dhcp-client-configuration-shepherd-provision config))
+            (interfaces (dhcp-client-configuration-interfaces config)))
        (list (shepherd-service
               (documentation "Set up networking via DHCP.")
               (requirement `(user-processes udev ,@requirement))
               (provision provision)
 
-              ;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when
-              ;; networking is unavailable, but also means that the interface is not up
-              ;; yet when 'start' completes.  To wait for the interface to be ready, one
-              ;; should instead monitor udev events.
               (start #~(lambda _
-                         (define dhclient
-                           (string-append #$package "/sbin/dhclient"))
+                         (use-modules (ice-9 popen)
+                                      (ice-9 rdelim))
 
-                         ;; When invoked without any arguments, 'dhclient' discovers all
+                         ;; When invoked without any arguments, the client discovers all
                          ;; non-loopback interfaces *that are up*.  However, the relevant
                          ;; interfaces are typically down at this point.  Thus we perform
                          ;; our own interface discovery here.
@@ -355,17 +351,40 @@ (define dhcp-client-shepherd-service
                                        (_
                                         #~'#$interfaces))))
 
-                         (false-if-exception (delete-file #$pid-file))
-                         (let ((pid (fork+exec-command
-                                     ;; By default dhclient uses a
-                                     ;; pre-standardization implementation of
-                                     ;; DDNS, which is incompatable with
-                                     ;; non-ISC DHCP servers; thus, pass '-I'.
-                                     ;; <https://kb.isc.org/docs/aa-01091>.
-                                     (cons* dhclient "-nw" "-I"
-                                            "-pf" #$pid-file ifaces))))
-                           (and (zero? (cdr (waitpid pid)))
-                                (read-pid-file #$pid-file)))))
+                         ;; Returns the execution configuration for the DHCP client
+                         ;; selected by the package field of dhcp-client-configuration.
+                         ;; The configuration is a pair of pidfile and execution command
+                         ;; where the latter is a list.
+                         (define exec-config
+                           (case (string->symbol #$client-name)
+                             ((isc-dhcp)
+                              (let ((pid-file "/var/run/dhclient.pid"))
+                                (cons
+                                  (cons* (string-append #$package "/sbin/dhclient")
+                                         "-nw" "-I" "-pf" pid-file ifaces)
+                                  pid-file)))
+                             ((dhcpcd)
+                              ;; For dhcpcd, the utilized pid-file depends on the
+                              ;; command-line arguments.  If multiple interfaces are
+                              ;; given, a different pid-file is returned.  Hence, we
+                              ;; consult dhcpcd itself to determine the pid-file.
+                              (let* ((cmd (string-append #$package "/sbin/dhcpcd"))
+                                     (arg (cons* cmd "-b" ifaces)))
+                                (cons arg
+                                  (let* ((pipe (string-join (append arg '("-P")) " "))
+                                         (port (open-input-pipe pipe))
+                                         (path (read-line port)))
+                                    (close-pipe port)
+                                    path))))
+                             (else
+                               (error (G_ "unknown 'package' value in dhcp-client-configuration")))))
+
+                         (let ((pid-file (cdr exec-config))
+                               (exec-cmd (car exec-config)))
+                           (false-if-exception (delete-file pid-file))
+                           (let ((pid (fork+exec-command exec-cmd)))
+                             (and (zero? (cdr (waitpid pid)))
+                                  (read-pid-file pid-file))))))
               (stop #~(make-kill-destructor))))))
     (package
      (warning (G_ "'dhcp-client' service now expects a \
@@ -377,10 +396,27 @@ (define dhcp-client-shepherd-service
       (dhcp-client-configuration
        (package package))))))
 
+(define (dhcp-client-account-service config)
+  (let ((package (dhcp-client-configuration-package config)))
+    ;; Contrary to other DHCP clients (e.g. dhclient), dhcpcd supports
+    ;; privilege separation.  Hence, we need to create an account here.
+    (if (string=? "dhcpcd" (package-name package))
+      (list (user-group (name "dhcpcd") (system? #t))
+            (user-account
+              (name "dhcpcd")
+              (group "dhcpcd")
+              (system? #t)
+              (comment "dhcpcd daemon user")
+              (home-directory "/var/empty")
+              (shell "/run/current-system/profile/sbin/nologin")))
+      '())))
+
 (define dhcp-client-service-type
   (service-type (name 'dhcp-client)
                 (extensions
-                 (list (service-extension shepherd-root-service-type
+                 (list (service-extension account-service-type
+                                          dhcp-client-account-service)
+                       (service-extension shepherd-root-service-type
                                           dhcp-client-shepherd-service)))
                 (default-value (dhcp-client-configuration))
                 (description "Run @command{dhcp}, a Dynamic Host Configuration




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at 68675 <at> debbugs.gnu.org:


Received: (at 68675) by debbugs.gnu.org; 23 Jan 2024 16:15:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 23 11:15:18 2024
Received: from localhost ([127.0.0.1]:43831 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSJQk-00030V-Jh
	for submit <at> debbugs.gnu.org; Tue, 23 Jan 2024 11:15:18 -0500
Received: from magnesium.8pit.net ([45.76.88.171]:32325)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>)
 id 1rSJQi-00030B-25; Tue, 23 Jan 2024 11:15:17 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=ylwLEsiJQe
 qqf+NJX+mmn48U8sRb5YrGFbXTO/ruGy0=;
 h=references:in-reply-to:date:
 subject:to:from; d=soeren-tempel.net; b=xfGunlT7e5SzNcst/Zsu3vetZQupcb
 ez0KMQgAkvp+p2BAPZqg2nnyvX8roRVkD95pK3c9wt83pzwL8IZJqCOCcFlJlYvP3NH0+K
 5AAMFcqM003RwlOr2vpKi4V0Lc+/hwQIJ5a+vUwukjZV6S/zQ3nUK+9pssIvlnSHhJtEXn
 8=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-1300-cfa0-a067-980d.310.pool.telefonica.de
 [2a02:3102:49da:1b:1300:cfa0:a067:980d])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id ea451ee2
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 23 Jan 2024 17:15:09 +0100 (CET)
From: soeren@HIDDEN
To: 68675 <at> debbugs.gnu.org
Subject: [PATCH] gnu: Add dhcpcd.
Date: Tue, 23 Jan 2024 17:14:55 +0100
Message-ID: <026d5ef86d6351918ee989f48be225bd97490d4d.1706026000.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1706026000.git.soeren@HIDDEN>
References: <cover.1706026000.git.soeren@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 68675
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

From: Sören Tempel <soeren@HIDDEN>

* gnu/packages/admin.scm (dhcpcd): new procedure.

Signed-off-by: Sören Tempel <soeren@HIDDEN>
---
 gnu/packages/admin.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index fcf05992d8..78a5bbd973 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1608,6 +1608,48 @@ (define-public isc-dhcp
       (license license:mpl2.0)
       (properties '((cpe-name . "dhcp"))))))
 
+(define-public dhcpcd
+  (package
+    (name "dhcpcd")
+    (version "10.0.6")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/NetworkConfiguration/dhcpcd")
+               (commit (string-append "v" version))))
+        (sha256
+         (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
+        (file-name (git-file-name name version))))
+    (native-inputs (list eudev))
+    (build-system gnu-build-system)
+    (arguments
+      (list
+        #:test-target "test"
+        #:configure-flags
+        #~(list "--enable-ipv6"
+                "--enable-privsep"
+                "--privsepuser=dhcpcd"
+                (string-append "--dbdir=" "/var/db/dhcpcd")
+                (string-append "--rundir=" "/var/run/dhcpcd")
+                "CC=gcc")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'do-not-create-dbdir
+              (lambda _
+                (substitute* "src/Makefile"
+                  (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}") ""))))
+            (add-before 'build 'setenv
+              (lambda _
+                (setenv "HOST_SH" (string-append #$bash-minimal "/bin/sh")))))))
+    (home-page "https://roy.marples.name/projects/dhcpcd")
+    (synopsis "Feature-rich DHCP and DHCPv6 client.")
+    (description "Provides a DHCP and a DHCPv6 client.  Additionally,
+dhcpcd is also an IPv4LL (aka ZeroConf) client.  In layperson's terms,
+dhcpcd runs on your machine and silently configures your computer to work
+on the attached networks without trouble and mostly without configuration.")
+    (license license:bsd-2)))
+
 (define-public radvd
   (package
     (name "radvd")




Information forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Jan 2024 16:13:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 23 11:13:35 2024
Received: from localhost ([127.0.0.1]:43825 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rSJP5-0002vn-2t
	for submit <at> debbugs.gnu.org; Tue, 23 Jan 2024 11:13:35 -0500
Received: from lists.gnu.org ([2001:470:142::17]:44664)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <soeren@HIDDEN>) id 1rSJP3-0002va-Lk
 for submit <at> debbugs.gnu.org; Tue, 23 Jan 2024 11:13:34 -0500
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 <soeren@HIDDEN>)
 id 1rSJOs-0002eG-Ql
 for guix-patches@HIDDEN; Tue, 23 Jan 2024 11:13:22 -0500
Received: from magnesium.8pit.net ([45.76.88.171])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <soeren@HIDDEN>)
 id 1rSJOq-0006YR-BF; Tue, 23 Jan 2024 11:13:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=opensmtpd; bh=dcnBEwsmPw
 MV6v6Wu6OMFNP1AaxSrHjSk2p4oVl0mmk=; h=date:subject:to:from;
 d=soeren-tempel.net; b=aL2LX+R49g44u1gktpjyxRR5sUv/hk/kLFAbYIiQbsdmNuu
 n+pzXv56CPKwKu0MWOFqZdSPSk50AE2FPacYNMkeXvacJF2uTyc2LRngb7CQJL4oisTmg4
 +Lh36fvgeqW28ayxdmltMsH47CK8anzwQlJqk2YVwMr4JRuXPUDpq4=
Received: from localhost
 (dynamic-2a02-3102-49da-001b-1300-cfa0-a067-980d.310.pool.telefonica.de
 [2a02:3102:49da:1b:1300:cfa0:a067:980d])
 by magnesium.8pit.net (OpenSMTPD) with ESMTPSA id 32adb324
 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:YES); 
 Tue, 23 Jan 2024 17:13:14 +0100 (CET)
From: soeren@HIDDEN
To: guix-patches@HIDDEN
Subject: [PATCH] Support dhcpcd in dhcp-client-service-type
Date: Tue, 23 Jan 2024 17:12:43 +0100
Message-ID: <cover.1706026000.git.soeren@HIDDEN>
X-Mailer: git-send-email 2.43.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=45.76.88.171;
 envelope-from=soeren@HIDDEN; helo=magnesium.8pit.net
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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

From: Sören Tempel <soeren@HIDDEN>

This patch series add support for an alternative DHCP client to
dhcp-client-service-type. This is necessary as, currently,
dhcp-client-service-type only supports the ISC DHCP implementation
and this implementation has reached its end-of-life in 2022(!).
For more information, refer to <https://issues.guix.gnu.org/68619>.

Specifically, this patch series adds support for dhcpcd. However, it
is not yet enabled by default. Nonetheless, I would strongly suggest
enabling it by default at a later point in time.

In order to enable dhcpcd add the following to /etc/config.scm:

	(service dhcp-client-service-type
	         (dhcp-client-configuration
	           (package dhcpcd)))

I have done some basics tests with this change applied with both
dhcpcd and isc-dhcp. Further tests and feedback would be much
appreciated!

Sören Tempel (2):
  gnu: Add dhcpcd.
  services: dhcp: Support the dhcpcd implementation.

 gnu/packages/admin.scm      | 42 +++++++++++++++++++
 gnu/services/networking.scm | 84 ++++++++++++++++++++++++++-----------
 2 files changed, 102 insertions(+), 24 deletions(-)


base-commit: 29c26a8d308286cf378ce9cfa3d73e3d1454263d




Acknowledgement sent to soeren@HIDDEN:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#68675; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.