From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id WLKsL/JRaWSxXAEASxT56A (envelope-from ) for ; Sun, 21 May 2023 01:04:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IN3dLvJRaWR2wAAAG6o9tA (envelope-from ) for ; Sun, 21 May 2023 01:04:18 +0200 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 483B437D8A for ; Sun, 21 May 2023 01:04:18 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q0VcK-0006WO-Bn; Sat, 20 May 2023 19:04:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0VcI-0006W8-Mp for bug-guix@gnu.org; Sat, 20 May 2023 19:04:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q0VcI-0001DH-Ep for bug-guix@gnu.org; Sat, 20 May 2023 19:04:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q0VcI-0000HU-0E for bug-guix@gnu.org; Sat, 20 May 2023 19:04:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#63516: Static networking should wait for interfaces to be up Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 20 May 2023 23:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63516 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 63516@debbugs.gnu.org Cc: Julien Lepiller Received: via spool by 63516-submit@debbugs.gnu.org id=B63516.16846238221041 (code B ref 63516); Sat, 20 May 2023 23:04:01 +0000 Received: (at 63516) by debbugs.gnu.org; 20 May 2023 23:03:42 +0000 Received: from localhost ([127.0.0.1]:59515 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q0Vbx-0000Gj-MD for submit@debbugs.gnu.org; Sat, 20 May 2023 19:03:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q0Vbt-0000GP-Vd for 63516@debbugs.gnu.org; Sat, 20 May 2023 19:03:40 -0400 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 1q0Vbl-0001Ai-Me; Sat, 20 May 2023 19:03:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=7OwbSfM7BCtWxCiYA/t16Kqo0vTY/g+Jarpz2snG6/o=; b=NXUFVU+gZrO8IyseV/Oc 24iDuvSuYyOn8ACujy4z+ZEdg+gUq8pwfCz3f9FGMNp1bg8CIdphpZTdbw5VuHaonobtt2Vg5YdLs z6Px+Yo9TYaK0tscByaQxUXWDk5zBhS4LVhnJOYfcptNmKloVy0MZUkHhmj8+M+mlY0WmB+2eXTGN iXahPtBiEc4Wb4EJspP220J5JKhXZFFEb6uyHHVG7xe3jnTwfP2PIW88az09cMcsyho0QreX9esD4 WMUv6rO0Do0/sjeZhQYWK68US+npyluPjan825OV/yctaFPGMZCySXrj/CV0Nwk53WjlHH4K8d7JO xQCovyHJ4NMwBg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q0Vbl-0001GO-9s; Sat, 20 May 2023 19:03:29 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87pm726iwd.fsf@inria.fr> Date: Sun, 21 May 2023 01:03:26 +0200 In-Reply-To: <87pm726iwd.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 15 May 2023 11:30:58 +0200") Message-ID: <871qjawqpt.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684623858; a=rsa-sha256; cv=none; b=lbH0z1l1NUtQ6dGmdqpJo2KQTSU1M2fng3dFR9EUyxULaUoBXfPJ0geMd7U6d804GuiW8z FazsEMjtqWnCt2oqA7J0Scs+NrDv/wYi8CLyEb2c+qXsSXim7udHSmdCj8+4UkkKSfiuwD ftDSIGAGjwS1FQQEMx4Tm+YTLjZ7cPYoUFrffsZAekkjOzUDl4Zcr7yPW+Qh2ekb9T4bgh yrrCZvVO3xVwe5HlrvVkZ5hAYvqKQDOgIn+vv1NgoT7TOzh7wq4oHfeh3AfiQMug2TWwRP +hfz6/+gNKGbh77wLbAOpqi+wVBCcDG9XC4dhaotRa5eNoe9IUyR+uAgbUUrsA== 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=NXUFVU+g; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1684623858; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=7OwbSfM7BCtWxCiYA/t16Kqo0vTY/g+Jarpz2snG6/o=; b=WGdZL5E0GVVwMbW+XzY+7o9oys1L4flxxRMwIvLRfLGEXJ6nBuvuLhBDl0v3t12+o7ulyg NZi6xXYcePYQMBX4lSMSQf5HA8WtASyIPFxGsp0jBWCzD/JYw+W4Mw+lhJdHyDysOZAwpA FiEwlgUrFtXSc/QPBxxExr4lL4S5bhYm80DWFEUHFo7xuBnXc6eijoRr/RD+3/s73naeyN m8n7hrMfV4kOEs67QSlxOVQw88k1+IqIrnJlzXWmaQUjvIngonCHG/u2G11ZNu+Ckb1YjM 0aJfSASAh4kqtEU4W6iKpoyiyKXLa9UXMom3YM1DDBPJaEyEJcEzbJJCEIhSow== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=NXUFVU+g; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.08 X-Spam-Score: -3.08 X-Migadu-Queue-Id: 483B437D8A X-TUID: qcL01zGHF346 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s skribis: > Before doing =E2=80=98addr-add=E2=80=99 in =E2=80=98network-set-up/linux= =E2=80=99, should we wait for > the interface to show up, by calling =E2=80=98get-links=E2=80=99 from Gui= le-Netlink or > something like that? Below is a simple workaround. How does that sound? A better fix would be to poll(2) on the underlying AF_NETLINK socket. In fact, we could also implement something like systemd=E2=80=99s =E2=80=98network-online.target=E2=80=99 by doing that. For that we=E2=80= =99d need Guile-Netlink to let us create SOCK_NONBLOCK sockets and to use real ports instead of raw file descriptors; Fibers would then take care of the rest. Thoughts? Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/services/base.scm b/gnu/services/base.scm index fd79c9e232..5d43d998c3 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2794,10 +2794,39 @@ (define (network-set-up/linux config) (scheme-file "set-up-network" (with-extensions (list guile-netlink) #~(begin - (use-modules (ip addr) (ip link) (ip route)) + (use-modules (ip addr) (ip link) (ip route) + (srfi srfi-1)) + + (define (wait-for-device device) + ;; Wait for DEVICE to show up. + ;; XXX: Polling is ridiculous. We should open a + ;; SOCK_NONBLOCK netlink socket and wait on it. + (let loop ((attempts 0)) + (unless (find (lambda (link) + (string=? (link-name link) + device)) + (get-links)) + (if (< attempts 30) + (begin + (format #t + "waiting for \ +networking device '~a'...~%" + device) + ((@ (fibers) sleep) 1) + (loop (+ 1 attempts))) + (begin + (format #t "networking device '~a' \ +did not show up; bailing out~%" + device) + #f))))) #$@(map (lambda (address) #~(begin + ;; Before going any further, wait for the + ;; device to show up. + (wait-for-device + #$(network-address-device address)) + (addr-add #$(network-address-device address) #$(network-address-value address) #:ipv6? --=-=-=--