From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id eD6eFN2QymV+eQEA62LTzQ:P1 (envelope-from ) for ; Mon, 12 Feb 2024 22:42:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id eD6eFN2QymV+eQEA62LTzQ (envelope-from ) for ; Mon, 12 Feb 2024 22:42:53 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HvWkqRpo; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707774173; a=rsa-sha256; cv=none; b=g5Lgwp0dZJg5q9VdaZasYy8q3j+ak5k46DS3uR/yImuHmUxywvfcCSlhPzsszIqH99nMEF NkVjhELNEcMmJPa1IMfIJHoBfDeJ3CFKXvbo/7TNAwZq8OoqEJLPcFdTSBb/qM+L/YbKv6 v0y7KY5Sa5C19JLQNf8YBMxxktuolbcfFitsZ1w8cbTsnzl00natGyQfkPEl9sHYAJU3RQ ZrFjr1IYhWucYs2FJuHkheqS/hNqB0W5S7g8XdM3V/CeQCzcyaePghgaV5cudpmMRiIj47 y0pfjhQlowyTe51owRAWehqL5l1WFCmc24LUvI/gaB9MH7BdGepf/nkRC5vh5A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HvWkqRpo; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707774173; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5nqP8feMrHaSDeo94RhuAIDEmse/4AoRGnrxtoql9OQ=; b=tQzx+9cRp5iAlNX4DqjQvWqaUD4FU9mUFyw/YpEHpQACIpChUcvtEWQ2tllYp3EHzw4xge zZji99DzJjtqF1BOYTclDMjpH3F8O0EtJ2MCdt4oXk8oVB1Cp+a7/wxVICRA9wSwUD5/yT GBKVF+3X7Qa0kJLZH2cl5Hpjlysvl5y96bkRXsAVu5Nc0jaasXDgL+0TgJWxmohl+GrcVw 30aFoJgpmYXm2/G3ls8On+JHQiikJ8g6XycRS3Ic5FjYjOJge+wfRLJ7cPeuwxo/i5pafk yrxNfPGruXrEFOcY0pQ7iuHHSl1n34+CJjfkZbSqDxfCGsK1Xg6ocSHbE4Xg2w== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0E8F8762D9 for ; Mon, 12 Feb 2024 22:42:53 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZe4c-0004k4-FP; Mon, 12 Feb 2024 16:42:46 -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 ) id 1rZe4b-0004jw-DE for guix-patches@gnu.org; Mon, 12 Feb 2024 16:42:45 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rZe4b-0003sE-4P for guix-patches@gnu.org; Mon, 12 Feb 2024 16:42:45 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZe4s-0001Ar-2Y for guix-patches@gnu.org; Mon, 12 Feb 2024 16:43:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd implementation. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Feb 2024 21:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68675 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: soeren@soeren-tempel.net Cc: 68675@debbugs.gnu.org Received: via spool by 68675-submit@debbugs.gnu.org id=B68675.17077741324287 (code B ref 68675); Mon, 12 Feb 2024 21:43:02 +0000 Received: (at 68675) by debbugs.gnu.org; 12 Feb 2024 21:42:12 +0000 Received: from localhost ([127.0.0.1]:33464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZe43-000173-Fi for submit@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 ) id 1rZe40-00016K-KT for 68675@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 ) 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@soeren-tempel.net> (soeren@soeren-tempel.net's message of "Wed, 24 Jan 2024 20:05:13 +0100") References: <2156325d2caa8d4298c9828d84fa5fff40592da4.1706123111.git.soeren@soeren-tempel.net> <5aff02159575834de675684dfde71d2ec66f4b10.1706123111.git.soeren@soeren-tempel.net> Date: Mon, 12 Feb 2024 22:41:42 +0100 Message-ID: <87ttmdbbs9.fsf@gnu.org> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Spam-Score: -7.18 X-Migadu-Queue-Id: 0E8F8762D9 X-Migadu-Spam-Score: -7.18 X-TUID: K0ieAr4w99Ya soeren@soeren-tempel.net skribis: > From: S=C3=B6ren Tempel > > 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 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 record (such as an ) 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.