From unknown Sat Aug 09 13:18:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#75100] [PATCH 0/3] Shepherd service of 'static-networking' completes in timely fashion Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Dec 2024 21:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75100 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75100@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17351609392682 (code B ref -1); Wed, 25 Dec 2024 21:09:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Dec 2024 21:08:59 +0000 Received: from localhost ([127.0.0.1]:39063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYcl-0000hC-HV for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:08:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:37740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYck-0000h3-0T for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:08:58 -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 1tQYcj-0008Q6-NR for guix-patches@gnu.org; Wed, 25 Dec 2024 16:08:57 -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 1tQYci-0000au-RE; Wed, 25 Dec 2024 16:08:56 -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:Subject:To:From:in-reply-to: references; bh=L1STKuAogU6yd87D0eMTbHDdOYiyb0hS6i28yuCJrXE=; b=q/Pxv60HmO6Wws LDagXt2pnsWK1BaPad4vtSkopTvwIJELq1aIPmF5IgY/0yfXlGPuMmAcccVP/LzFrih85ssaGNgQn HcN2nAnWBQVZWR0Nrjji2q+qQRuOHrWChQcqqbXYDyAudHgCopTez+Hh+B6M9wNa+oaALXojs+wnQ bEg9RVYZIEYKu/uk0aqnAsrd6c67vvhQD/hkDXCSkG6akoWpT7ZqjyPeT0BnJI+tr81qed6PMaBQi mmallup89jAIVTy9aTHkH2q3ng9AqIRF6zBbp/iPphi64EoP2ra2rpV6IUrV5Bmsn7SBEZiWxGR/L C/zRF/9GqxzKXbgG+BTQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 25 Dec 2024 22:08:47 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, This is a fix for , a bug whereby the ‘start’ method of the static-networking service could remain in “starting” state forever. With this patch, it now fails within a minute. Feedback welcome! Ludo’. Ludovic Courtès (3): services: static-networking: Run set-up/tear-down as a separate process. services: static-networking: Fail when devices don’t show up. tests: Run without the Linux kernel “quiet” argument. gnu/services/base.scm | 370 ++++++++++++++++++++------------------- gnu/tests.scm | 3 +- gnu/tests/networking.scm | 71 +++++++- 3 files changed, 263 insertions(+), 181 deletions(-) base-commit: b66b58123d9598bdd9d33b4af8334fecd2419d5f -- 2.46.0 From unknown Sat Aug 09 13:18:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#75100] [PATCH 1/3] services: static-networking: Run set-up/tear-down as a separate process. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Dec 2024 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75100 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75100@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 75100-submit@debbugs.gnu.org id=B75100.17351613514139 (code B ref 75100); Wed, 25 Dec 2024 21:16:02 +0000 Received: (at 75100) by debbugs.gnu.org; 25 Dec 2024 21:15:51 +0000 Received: from localhost ([127.0.0.1]:39079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYjO-00014b-Db for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:15:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYjM-00014M-K0 for 75100@debbugs.gnu.org; Wed, 25 Dec 2024 16:15:49 -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 1tQYjG-0001kv-SO; Wed, 25 Dec 2024 16:15:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=tlay9kiZqAp3GBKTLgftPi1SANrFEAPbdVrOegM9ZTE=; b=OFviXy+5WoGwU3KMBTph tqaqTlP84L7/5Ra5fqoX7hfQWw755LchmgQo2hirOQsy+lwGk72fE3bij2pKZHsBY8339ZyIE+G6b iLrYBGrPKOVQ/Y1aWT6N8LNgNIdfX2Qy5wJOIzwGdMtJHtGohwV5q+FDVjalL2ipRBybbU3e02NtQ yoBCO3s3SDRAdLiBDOpZXeSFAMQhAEOQs+F4a0J50o7dv7Y0dTvvVaFF7XyCjmOh2Zg0WOqv69M6x JVzPeCCDgdiwxmN/3s/TdetbacH9ZtMDLs+N5mWNUQmgGjMCfUeU5TbViCf4ANIoS+3oq7f+NSpuJ NQSnoMzBEo/POQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 25 Dec 2024 22:15:31 +0100 Message-ID: <42215a4536fa59b6d30e5346289043f8ab17b239.1735160803.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Running that code in PID 1 was fun but it’s not really beneficial and somewhat risky: risk of blocking, file descriptor leak, inability to reload Guile-Netlink in shepherd when it’s upgraded, and so on. This change runs set-up and tear-down as separate processes, which, for the price of one fork(1), buys us peace of mind. * gnu/services/base.scm (network-set-up/hurd, network-tear-down/hurd) (network-tear-down/linux): Use ‘program-file’ instead of ‘scheme-file’. (network-set-up/linux): Likewise, and remove #:blocking? argument to ‘wait-for-link’. Change-Id: Ia41479b50eab31ea40c67243fcb1cffe29ac874a --- gnu/services/base.scm | 361 +++++++++++++++++++++--------------------- 1 file changed, 181 insertions(+), 180 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index fc604f029a..f6d1da61cd 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -3055,172 +3055,139 @@ (define (network-set-up/hurd config) ;; The Hurd implements SIOCGIFADDR and other old-style ioctls, but the only ;; way to set up IPv6 is by starting pfinet with the right options. (if (equal? (static-networking-provision config) '(loopback)) - (scheme-file "set-up-pflocal" #~(begin 'nothing-to-do! #t)) - (scheme-file "set-up-pfinet" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils) - (ice-9 format)) + (program-file "set-up-pflocal" #~(begin 'nothing-to-do! #t)) + (program-file "set-up-pfinet" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (ice-9 format)) - ;; TODO: Do that without forking. - (let ((options '#$(static-networking->hurd-pfinet-options - config))) - (format #t "starting '~a~{ ~s~}'~%" + ;; TODO: Do that without forking. + (let ((options '#$(static-networking->hurd-pfinet-options + config))) + (format #t "starting '~a~{ ~s~}'~%" + #$(file-append hurd "/hurd/pfinet") + options) + (apply invoke #$(file-append hurd "/bin/settrans") + "--active" + "--create" + "--keep-active" + "/servers/socket/2" #$(file-append hurd "/hurd/pfinet") - options) - (apply invoke #$(file-append hurd "/bin/settrans") - "--active" - "--create" - "--keep-active" - "/servers/socket/2" - #$(file-append hurd "/hurd/pfinet") - options))))))) + options))))))) (define (network-tear-down/hurd config) - (scheme-file "tear-down-pfinet" - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils)) + (program-file "tear-down-pfinet" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) - ;; Forcefully terminate pfinet. XXX: In theory this - ;; should just undo the addresses and routes of CONFIG; - ;; this could be done using ioctls like SIOCDELRT, but - ;; these are IPv4-only; another option would be to use - ;; fsysopts but that seems to crash pfinet. - (invoke #$(file-append hurd "/bin/settrans") "-fg" - "/servers/socket/2") - #f)))) + ;; Forcefully terminate pfinet. XXX: In theory this + ;; should just undo the addresses and routes of CONFIG; + ;; this could be done using ioctls like SIOCDELRT, but + ;; these are IPv4-only; another option would be to use + ;; fsysopts but that seems to crash pfinet. + (invoke #$(file-append hurd "/bin/settrans") "-fg" + "/servers/socket/2") + #f)))) (define (network-set-up/linux config) (match-record config (addresses links routes) - (scheme-file "set-up-network" - (with-extensions (list guile-netlink) - #~(begin - (use-modules (ip addr) (ip link) (ip route) - (srfi srfi-1) - (ice-9 format) - (ice-9 match)) + (program-file "set-up-network" + (with-extensions (list guile-netlink) + #~(begin + (use-modules (ip addr) (ip link) (ip route) + (srfi srfi-1) + (ice-9 format) + (ice-9 match)) - (define (match-link-by field-accessor value) - (fold (lambda (link result) - (if (equal? (field-accessor link) value) - link - result)) - #f - (get-links))) + (define (match-link-by field-accessor value) + (fold (lambda (link result) + (if (equal? (field-accessor link) value) + link + result)) + #f + (get-links))) - (define (alist->keyword+value alist) - (fold (match-lambda* - (((k . v) r) - (cons* (symbol->keyword k) v r))) '() alist)) + (define (alist->keyword+value alist) + (fold (match-lambda* + (((k . v) r) + (cons* (symbol->keyword k) v r))) '() alist)) - ;; FIXME: It is interesting that "modprobe bonding" creates an - ;; interface bond0 straigt away. If we won't have bonding - ;; module, and execute `ip link add name bond0 type bond' we - ;; will get - ;; - ;; RTNETLINK answers: File exists - ;; - ;; This breaks our configuration if we want to - ;; use `bond0' name. Create (force modprobe - ;; bonding) and delete the interface to free up - ;; bond0 name. - #$(let lp ((links links)) - (cond - ((null? links) #f) - ((and (network-link? (car links)) - ;; Type is not mandatory - (false-if-exception - (eq? (network-link-type (car links)) 'bond))) - #~(begin - (false-if-exception (link-add "bond0" "bond")) - (link-del "bond0"))) - (else (lp (cdr links))))) + ;; FIXME: It is interesting that "modprobe bonding" creates an + ;; interface bond0 straigt away. If we won't have bonding + ;; module, and execute `ip link add name bond0 type bond' we + ;; will get + ;; + ;; RTNETLINK answers: File exists + ;; + ;; This breaks our configuration if we want to + ;; use `bond0' name. Create (force modprobe + ;; bonding) and delete the interface to free up + ;; bond0 name. + #$(let lp ((links links)) + (cond + ((null? links) #f) + ((and (network-link? (car links)) + ;; Type is not mandatory + (false-if-exception + (eq? (network-link-type (car links)) 'bond))) + #~(begin + (false-if-exception (link-add "bond0" "bond")) + (link-del "bond0"))) + (else (lp (cdr links))))) - #$@(map (match-lambda - (($ name type mac-address arguments) - (cond - ;; Create a new interface - ((and (string? name) (symbol? type)) - #~(begin - (link-add #$name (symbol->string '#$type) #:type-args '#$arguments) - ;; XXX: If we add routes, addresses must be - ;; already assigned, and interfaces must be - ;; up. It doesn't matter if they won't have - ;; carrier or anything. - (link-set #$name #:up #t))) + #$@(map (match-lambda + (($ name type mac-address arguments) + (cond + ;; Create a new interface + ((and (string? name) (symbol? type)) + #~(begin + (link-add #$name (symbol->string '#$type) #:type-args '#$arguments) + ;; XXX: If we add routes, addresses must be + ;; already assigned, and interfaces must be + ;; up. It doesn't matter if they won't have + ;; carrier or anything. + (link-set #$name #:up #t))) - ;; Amend an existing interface - ((and (string? name) - (eq? type #f)) - #~(let ((link (match-link-by link-name #$name))) - (if link - (apply link-set - (link-id link) - (alist->keyword+value '#$arguments)) - (format #t (G_ "Interface with name '~a' not found~%") #$name)))) - ((string? mac-address) - #~(let ((link (match-link-by link-addr #$mac-address))) - (if link - (apply link-set - (link-id link) - (alist->keyword+value '#$arguments)) - (format #t (G_ "Interface with mac-address '~a' not found~%") #$mac-address))))))) - links) + ;; Amend an existing interface + ((and (string? name) + (eq? type #f)) + #~(let ((link (match-link-by link-name #$name))) + (if link + (apply link-set + (link-id link) + (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with name '~a' not found~%") #$name)))) + ((string? mac-address) + #~(let ((link (match-link-by link-addr #$mac-address))) + (if link + (apply link-set + (link-id link) + (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with mac-address '~a' not found~%") #$mac-address))))))) + links) - #$@(map (lambda (address) - #~(begin - ;; Before going any further, wait for the - ;; device to show up. - (wait-for-link - #$(network-address-device address) - #:blocking? #f) + #$@(map (lambda (address) + #~(begin + ;; Before going any further, wait for the + ;; device to show up. + (wait-for-link + #$(network-address-device address)) - (addr-add #$(network-address-device address) - #$(network-address-value address) - #:ipv6? - #$(network-address-ipv6? address)) - ;; FIXME: loopback? - (link-set #$(network-address-device address) - #:multicast-on #t - #:up #t))) - addresses) + (addr-add #$(network-address-device address) + #$(network-address-value address) + #:ipv6? + #$(network-address-ipv6? address)) + ;; FIXME: loopback? + (link-set #$(network-address-device address) + #:multicast-on #t + #:up #t))) + addresses) - #$@(map (lambda (route) - #~(route-add #$(network-route-destination route) - #:device - #$(network-route-device route) - #:ipv6? - #$(network-route-ipv6? route) - #:via - #$(network-route-gateway route) - #:src - #$(network-route-source route))) - routes) - #t))))) - -(define (network-tear-down/linux config) - (match-record config - (addresses links routes) - (scheme-file "tear-down-network" - (with-extensions (list guile-netlink) - #~(begin - (use-modules (ip addr) (ip link) (ip route) - (netlink error) - (srfi srfi-34)) - - (define-syntax-rule (false-if-netlink-error exp) - (guard (c ((netlink-error? c) #f)) - exp)) - - ;; Wrap calls in 'false-if-netlink-error' so this - ;; script goes as far as possible undoing the effects - ;; of "set-up-network". - - #$@(map (lambda (route) - #~(false-if-netlink-error - (route-del #$(network-route-destination route) + #$@(map (lambda (route) + #~(route-add #$(network-route-destination route) #:device #$(network-route-device route) #:ipv6? @@ -3228,31 +3195,63 @@ (define (network-tear-down/linux config) #:via #$(network-route-gateway route) #:src - #$(network-route-source route)))) - routes) + #$(network-route-source route))) + routes) + #t))))) - ;; Cleanup addresses first, they might be assigned to - ;; created bonds, vlans or bridges. - #$@(map (lambda (address) - #~(false-if-netlink-error - (addr-del #$(network-address-device - address) - #$(network-address-value address) - #:ipv6? - #$(network-address-ipv6? address)))) - addresses) +(define (network-tear-down/linux config) + (match-record config + (addresses links routes) + (program-file "tear-down-network" + (with-extensions (list guile-netlink) + #~(begin + (use-modules (ip addr) (ip link) (ip route) + (netlink error) + (srfi srfi-34)) - ;; It is now safe to delete some links - #$@(map (match-lambda - (($ name type mac-address arguments) - (cond - ;; We delete interfaces that were created - ((and (string? name) (symbol? type)) - #~(false-if-netlink-error - (link-del #$name))) - (else #t)))) - links) - #f))))) + (define-syntax-rule (false-if-netlink-error exp) + (guard (c ((netlink-error? c) #f)) + exp)) + + ;; Wrap calls in 'false-if-netlink-error' so this + ;; script goes as far as possible undoing the effects + ;; of "set-up-network". + + #$@(map (lambda (route) + #~(false-if-netlink-error + (route-del #$(network-route-destination route) + #:device + #$(network-route-device route) + #:ipv6? + #$(network-route-ipv6? route) + #:via + #$(network-route-gateway route) + #:src + #$(network-route-source route)))) + routes) + + ;; Cleanup addresses first, they might be assigned to + ;; created bonds, vlans or bridges. + #$@(map (lambda (address) + #~(false-if-netlink-error + (addr-del #$(network-address-device + address) + #$(network-address-value address) + #:ipv6? + #$(network-address-ipv6? address)))) + addresses) + + ;; It is now safe to delete some links + #$@(map (match-lambda + (($ name type mac-address arguments) + (cond + ;; We delete interfaces that were created + ((and (string? name) (symbol? type)) + #~(false-if-netlink-error + (link-del #$name))) + (else #t)))) + links) + #f))))) (define (static-networking-shepherd-service config) (match-record config @@ -3267,16 +3266,18 @@ (define (static-networking-shepherd-service config) (start #~(lambda _ ;; Return #t if successfully started. - (load #$(let-system (system target) - (if (string-contains (or target system) "-linux") - (network-set-up/linux config) - (network-set-up/hurd config)))))) + (zero? (system* + #$(let-system (system target) + (if (string-contains (or target system) "-linux") + (network-set-up/linux config) + (network-set-up/hurd config))))))) (stop #~(lambda _ ;; Return #f is successfully stopped. - (load #$(let-system (system target) - (if (string-contains (or target system) "-linux") - (network-tear-down/linux config) - (network-tear-down/hurd config)))))) + (zero? (system* + #$(let-system (system target) + (if (string-contains (or target system) "-linux") + (network-tear-down/linux config) + (network-tear-down/hurd config))))))) (respawn? #f))))) (define (static-networking-shepherd-services networks) -- 2.46.0 From unknown Sat Aug 09 13:18:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#75100] [PATCH 2/3] services: static-networking: Fail when devices =?UTF-8?Q?don=E2=80=99t?= show up. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Dec 2024 21:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75100 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75100@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 75100-submit@debbugs.gnu.org id=B75100.17351613564155 (code B ref 75100); Wed, 25 Dec 2024 21:16:02 +0000 Received: (at 75100) by debbugs.gnu.org; 25 Dec 2024 21:15:56 +0000 Received: from localhost ([127.0.0.1]:39081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYjT-00014w-Gs for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:15:56 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYjO-00014P-0f for 75100@debbugs.gnu.org; Wed, 25 Dec 2024 16:15:50 -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 1tQYjI-0001lN-Ey; Wed, 25 Dec 2024 16:15:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=D4eim0hLV76tbw/BpRi80aW2dYz9ZnpNh61wWqjcz4M=; b=ki1KI7zUbITSPXDjmzE/ L35VT3XY3v9BWUd2ww2nbTDqh9RG+TWtWRMpdbKk5IECyeyMNm7QMrXZSx1vjFOkgIZupjta7dASB ujeqxIiaqld2xSBa/lyq0rSQ7692n1z6bBT7qHPSC7BCKM7NcHbpLDRHPqgXh1voQCfz7L7lo8O63 3rDKTN7oQ9quQUrCeI/1UHAJkvPKQzeiTOTsut2MHlCsKotGGYAPo/iAp7kq0jLAuw6z9LOhXOc9M CCfCwVKuF0Oz722R2+Mi++5w23p9BwZpEPTGasxzltJ/cPx+yciS2AkFjucrfGV6Hvhdea90lOctt ugyLJFoRMcr/fw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 25 Dec 2024 22:15:32 +0100 Message-ID: <700b204dd526e7b7c13b11759191306587f7d6ec.1735160803.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Fixes . * gnu/services/base.scm (network-set-up/linux): Define ‘max-set-up-duration’ and use it. * gnu/tests/networking.scm (%static-networking-with-nonexistent-device): New variable. (run-static-networking-failure-test): New procedure. (%test-static-networking-failure): New variable. Change-Id: Idba9b36750aa8c6368c8f6d1bc1358066f7432e4 --- gnu/services/base.scm | 17 ++++++++-- gnu/tests/networking.scm | 71 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index f6d1da61cd..15497b23f7 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -3092,6 +3092,10 @@ (define (network-tear-down/hurd config) #f)))) (define (network-set-up/linux config) + (define max-set-up-duration + ;; Maximum waiting time in seconds for devices to be up. + 60) + (match-record config (addresses links routes) (program-file "set-up-network" @@ -3169,12 +3173,19 @@ (define (network-set-up/linux config) (format #t (G_ "Interface with mac-address '~a' not found~%") #$mac-address))))))) links) + ;; 'wait-for-link' below could wait forever when + ;; passed a non-existent device. To ensure timely + ;; completion, install an alarm. + (alarm #$max-set-up-duration) + #$@(map (lambda (address) - #~(begin + #~(let ((device + #$(network-address-device address))) ;; Before going any further, wait for the ;; device to show up. - (wait-for-link - #$(network-address-device address)) + (format #t "Waiting for network device '~a'...~%" + device) + (wait-for-link device) (addr-add #$(network-address-device address) #$(network-address-value address) diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index b1ab43efb6..e7c02b9e00 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2018 Chris Marusich ;;; Copyright © 2018 Arun Isaac ;;; Copyright © 2021 Maxime Devos -;;; Copyright © 2021, 2023 Ludovic Courtès +;;; Copyright © 2021, 2023-2024 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +39,7 @@ (define-module (gnu tests networking) #:use-module (gnu services shepherd) #:use-module (ice-9 match) #:export (%test-static-networking + %test-static-networking-failure %test-static-networking-advanced %test-inetd %test-openvswitch @@ -124,7 +125,75 @@ (define %test-static-networking #:imported-modules '((gnu services herd) (guix combinators))))) (run-static-networking-test (virtual-machine os)))))) + +(define %static-networking-with-nonexistent-device + ;; Similar to %QEMU-STATIC-NETWORKING except that the device does not exist. + (static-networking + (addresses (list (network-address + (device "does-not-exist") ;<- really + (value "10.0.2.15/24")))) + (routes (list (network-route + (destination "default") + (gateway "10.0.2.2")))) + (requirement '()) + (provision '(networking)) + (name-servers '("10.0.2.3")))) + +(define (run-static-networking-failure-test vm) + (define test + (with-imported-modules '((gnu build marionette) + (guix build syscalls)) + #~(begin + (use-modules (gnu build marionette) + (guix build syscalls) + (srfi srfi-64)) + + (define marionette + (make-marionette '(#$vm))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "static-networking") + + (test-equal "service fails to start" + #f + ;; The 'start' method of the 'networking' service should fail + ;; within a minute or so. Previously it would never complete: + ;; . + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (alarm 180) ;must complete in a timely fashion + (start-service 'networking)) + marionette)) + + (test-equal "network interfaces" + '("lo") + (marionette-eval + '(begin + (use-modules (guix build syscalls)) + (network-interface-names)) + marionette)) + + (test-end)))) + + (gexp->derivation "static-networking-failure" test)) + +(define %test-static-networking-failure + (system-test + (name "static-networking-failure") + (description "Test the behavior of the 'static-networking' service when +passed an invalid device.") + (value + (let ((os (marionette-operating-system + (simple-operating-system + (service static-networking-service-type + (list %static-networking-with-nonexistent-device))) + #:imported-modules '((gnu services herd) + (guix combinators))))) + (run-static-networking-failure-test (virtual-machine os)))))) + + (define (run-static-networking-advanced-test vm) (define test (with-imported-modules '((gnu build marionette) -- 2.46.0 From unknown Sat Aug 09 13:18:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#75100] [PATCH 3/3] tests: Run without the Linux kernel =?UTF-8?Q?=E2=80=9Cquiet=E2=80=9D?= argument. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 25 Dec 2024 21:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75100 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75100@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 75100-submit@debbugs.gnu.org id=B75100.17351613624190 (code B ref 75100); Wed, 25 Dec 2024 21:16:03 +0000 Received: (at 75100) by debbugs.gnu.org; 25 Dec 2024 21:16:02 +0000 Received: from localhost ([127.0.0.1]:39085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYja-00015Q-3e for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:16:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYjX-00014s-BJ for 75100@debbugs.gnu.org; Wed, 25 Dec 2024 16:16:00 -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 1tQYjR-0001mS-Ny; Wed, 25 Dec 2024 16:15: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:References:In-Reply-To:Date:Subject:To: From; bh=5GXmP73wHAMr/Z262Sv94f7+8Ii2r8BIZFu+J6/yr6c=; b=DyUdbqwUiCFbY5U6AQRE grFX2is4bvs8c38UlmfgjpJ/c9GqUwt+ElFt5nWH078IcyKx3hF0RnNBlvov96vuawRDQX+F5Uuxh 86y/d6TTm/80s/KQKsvD7i6yb5UaxmyWBT0/4pO8I2b8IwkDtyzSs5oxAlZrfdbPDUKzMj6AWTiND tP/NFZBvHqTAIV6Q3IlW6sO6K169fVtg6+U5eTqSJ89M4N8qMp9f/uhIOfUXpoiPZo4td61nygl9F fcRxAqKFsUoJ1u0Oh8yjftdAVPyKzwTc0LFQ8KE47hhQz68kjE0qP7AulVkUthdLOpBz7mSR/niWK rqwarybMA0lURg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 25 Dec 2024 22:15:33 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * gnu/tests.scm (%simple-os)[kernel-arguments]: New field. Change-Id: I206597074ce5f4a719bd8cd98e9429c00e18b5a3 --- gnu/tests.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/tests.scm b/gnu/tests.scm index 5ff9db82fc..2a9e51511f 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016-2020, 2022-2023 Ludovic Courtès +;;; Copyright © 2016-2020, 2022-2024 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2021 Maxime Devos @@ -243,6 +243,7 @@ (define %simple-os (mount-point "/") (type "ext4")) %base-file-systems)) + (kernel-arguments (delete "quiet" %default-kernel-arguments)) (firmware '()) (users (cons (user-account -- 2.46.0 From unknown Sat Aug 09 13:18:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#75100: closed (Re: [bug#75100] [PATCH 0/3] Shepherd service of 'static-networking' completes in timely fashion) Message-ID: References: <87tta8sxb2.fsf@gnu.org> X-Gnu-PR-Message: they-closed 75100 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 75100@debbugs.gnu.org Date: Wed, 08 Jan 2025 23:26:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1736378763-5114-1" This is a multi-part message in MIME format... ------------=_1736378763-5114-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #75100: [PATCH 0/3] Shepherd service of 'static-networking' completes in ti= mely fashion which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 75100@debbugs.gnu.org. --=20 75100: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75100 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1736378763-5114-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 75100-done) by debbugs.gnu.org; 8 Jan 2025 23:25:31 +0000 Received: from localhost ([127.0.0.1]:49484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVfQZ-0001JN-80 for submit@debbugs.gnu.org; Wed, 08 Jan 2025 18:25:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56370) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVfQW-0001Ix-Jq; Wed, 08 Jan 2025 18:25:29 -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 1tVfQR-0002q6-B9; Wed, 08 Jan 2025 18:25:23 -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=diht+yyw6GCesPW7hFsCNwSTt1N6be7cY3G4pWEFggE=; b=JDm+CdOQ8A6rgp7iJKWi XvGk/FGlsRHopPgw9ZzRGQwnMJlbgBxQ9khXfLZx5/cuHISB8hgCnXTixdegEuHtfmfTo0HhzomIY qK3/cSnn3dzi9XTwYiNK5Ekicod/95EZOQ9S2KQH82HWKjqcQWn9IAD/qHAX000E3B64Upx9OYjYc //e3+XD9J1sEzv0GygJTYPjLcQwr0x+1a667GrHVTh2YsPb2JwnOnDK+jhbO+qUYxxL7WDLMsrR3w 2xxe2epWKUZokES9AoTijxaizOVmTIv8eSL5s53MytNvCv+zTYIijzZik4oJSebxnm7fB8Jqif2Mj UDWZh0khDfrXlA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 75100-done@debbugs.gnu.org, 71173-done@debbugs.gnu.org Subject: Re: [bug#75100] [PATCH 0/3] Shepherd service of 'static-networking' completes in timely fashion In-Reply-To: ("Ludovic =?utf-8?Q?Court?= =?utf-8?Q?=C3=A8s=22's?= message of "Wed, 25 Dec 2024 22:08:47 +0100") References: Date: Thu, 09 Jan 2025 00:25:21 +0100 Message-ID: <87tta8sxb2.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75100-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Pushed: 20a74ce28d tests: Run without the Linux kernel =E2=80=9Cquiet=E2=80=9D ar= gument. 431ab10344 services: static-networking: Fail when devices don=E2=80=99t s= how up. 8d649a8d17 services: static-networking: Run set-up/tear-down as a separat= e process. ------------=_1736378763-5114-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Dec 2024 21:08:59 +0000 Received: from localhost ([127.0.0.1]:39063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYcl-0000hC-HV for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:08:59 -0500 Received: from lists.gnu.org ([209.51.188.17]:37740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQYck-0000h3-0T for submit@debbugs.gnu.org; Wed, 25 Dec 2024 16:08:58 -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 1tQYcj-0008Q6-NR for guix-patches@gnu.org; Wed, 25 Dec 2024 16:08:57 -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 1tQYci-0000au-RE; Wed, 25 Dec 2024 16:08:56 -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:Subject:To:From:in-reply-to: references; bh=L1STKuAogU6yd87D0eMTbHDdOYiyb0hS6i28yuCJrXE=; b=q/Pxv60HmO6Wws LDagXt2pnsWK1BaPad4vtSkopTvwIJELq1aIPmF5IgY/0yfXlGPuMmAcccVP/LzFrih85ssaGNgQn HcN2nAnWBQVZWR0Nrjji2q+qQRuOHrWChQcqqbXYDyAudHgCopTez+Hh+B6M9wNa+oaALXojs+wnQ bEg9RVYZIEYKu/uk0aqnAsrd6c67vvhQD/hkDXCSkG6akoWpT7ZqjyPeT0BnJI+tr81qed6PMaBQi mmallup89jAIVTy9aTHkH2q3ng9AqIRF6zBbp/iPphi64EoP2ra2rpV6IUrV5Bmsn7SBEZiWxGR/L C/zRF/9GqxzKXbgG+BTQ==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/3] Shepherd service of 'static-networking' completes in timely fashion Date: Wed, 25 Dec 2024 22:08:47 +0100 Message-ID: X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello, This is a fix for , a bug whereby the ‘start’ method of the static-networking service could remain in “starting” state forever. With this patch, it now fails within a minute. Feedback welcome! Ludo’. Ludovic Courtès (3): services: static-networking: Run set-up/tear-down as a separate process. services: static-networking: Fail when devices don’t show up. tests: Run without the Linux kernel “quiet” argument. gnu/services/base.scm | 370 ++++++++++++++++++++------------------- gnu/tests.scm | 3 +- gnu/tests/networking.scm | 71 +++++++- 3 files changed, 263 insertions(+), 181 deletions(-) base-commit: b66b58123d9598bdd9d33b4af8334fecd2419d5f -- 2.46.0 ------------=_1736378763-5114-1--