From nobody Thu Aug 29 16:06:21 2024 X-Original-To: freebsd-net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WvmNx2ds1z5T8Kf for ; Thu, 29 Aug 2024 16:06:25 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WvmNx0WRXz529c; Thu, 29 Aug 2024 16:06:25 +0000 (UTC) (envelope-from bapt@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724947585; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=ajBGEfAUNqJ0uOaOBqUohsA5WnWKaRNutslcbJxmxws=; b=jrkekBcYA7M8Wk4ToQbVIIOmcgD5tSCQHqikOvTQLm0R7SZoWXRwZv1XsJNQVZS1fWxi7p cMA3WlSXBLq1RfHY7j1c6YM81iwPncKUwMZ2B1pqJObmgTR9tlu2doNhbBrch1CzdkHBCS EFf2EhWA7+c6QJA4ZXKw0FFy04LWrCbeIfZxlv7ywU3bJjjv/LmetlEUUv/Y0brYMKqDgF 7gqwsE4PZXRrmKnuBUUvfSWakR+xWhlqpVm7zx5923mymxFmvPXYFXii69bGrce0KZQRiY 3AD9tRQsA0NSgQ7rvmf4IE/hmUCI8wl0SW2SQXsIi0YvebLsxaPq6fl5utwZ+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724947585; a=rsa-sha256; cv=none; b=ZHSB8BmYNXt00kYwd80dQvedlAPV9tOYSJ+WY/Dp0UQF7pt3+OjpljUymJw6c5ADC1PedN 56ev5r7rLREOpXpL0IXxoviyDRbcPwI4iqAMTSTfHpmwjdfQjPqzM4M9rOVdgSOD3u+ELz F6TrGrKG4tCZJ+HneOTfnBvi+lf37I/62AsIfCfSVgbf9hD9L6gD2tcpUHsUyTjgaQG2JB ZwOK3tVe2NPvKRcy5aj3PTpOqc2qxi8jeuQgP8SzrX+CMhZea1JdASdB1/NYv+zGYHIMku eQ3oUIiKNN6+FeEJGxIWjSdjdXZgNE065FHmM9pMXRZ9lIE8Rs4iF4ClfUgh/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724947585; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=ajBGEfAUNqJ0uOaOBqUohsA5WnWKaRNutslcbJxmxws=; b=hQvSdXE2g6HoShdqIA1/icEDkN21o1m3eicdde1SYzFPaX01ScS7gTfCKfb7cDzLqVGb06 Jon4nxTxuS9+ZwbO8Rpkfm59aNtfXsClfgkTribRXJ7+KfTkRCKIJCw9xaSFBtR3SxJcYQ nIEFXbYiDpV+cV6WKcYZUaayGbeIe4fw81McEFEi4uwd8saUYYj9Big/V1Ji/wXDgLbOMF cyvDxGRYCbZIlIzk84RaBqbgT/10IrdKBysXRLC8kY+WQXK9ZM9Ep3FCxgzYMP2rv92DU3 i/Ogoo8aB1nFe26g/3ynJtx6QrF19PgRTl3QKB3blB7IhtxvZqeCinyMAu97Sw== Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WvmNw6Xg0zPws; Thu, 29 Aug 2024 16:06:24 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id B01CFFEFE5; Thu, 29 Aug 2024 18:06:21 +0200 (CEST) Date: Thu, 29 Aug 2024 18:06:21 +0200 From: Baptiste Daroussin To: Freddie Cash Cc: "yann.masson@thehomecave.fr" , freebsd-net@freebsd.org Subject: Re: wait link up before route configuration Message-ID: References: List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed 28 Aug 08:40, Freddie Cash wrote: > On Wed, Aug 28, 2024 at 1:21 AM yann.masson@thehomecave.fr < > yann.masson@thehomecave.fr> wrote: > > > After configuring interfaces and routes, and triggering a 'service netif > > restart && service routing restart' is there a way to wait for the 'carrier > > up' of the interface before route reconfiguration? My use case is a server > > with 2 Mellanox and a Lagg. The 2 mce interfaces are UP in milliseconds but > > the lagg interface takes a few seconds to be UP, and the routing service > > says 'Network unreachable'. The subnet is a /32 and the gateway need a > > static route like: # /etc/rc.conf.d/netif cloned_interfaces="lagg0" > > ifconfig_mce0="up" ifconfig_mce1="up" ifconfig_lagg0="laggproto lacp > > laggport mce0 laggport mce1 198.51.100.1 netmask 255.255.255.255 mtu 1500" > > # /etc/rc.conf.d/routing route_defaultgw="-host 203.0.113.1 -link > > -interface lagg0" defaultrouter="203.0.113.1" static_routes="defaultgw" If > > I run 'service netif restart && sleep 5 && service routing restart', > > everything is ok. I didn't find any options for that, and was thinking > > about a patch in the routing script. Thanks > > > Read through the comments in /etc/rc.d/netwait as that should do what > you're looking for (wait until the interface is active or wait until you > get a ping response from an IP before continuing with network > configuration). > The problem is the route (set by routing rc script) is not reachable until the lagg is ready/up but there is 0 mecanism in the routing script to to an equivalent of netwait. In my opinion we should implement in routing_netwait_if or routing_netwait_ip to make routing wait on some iface to be ready, it can be useful for cases like lagg, but could also be useful for cases like wireguard (when setup only via netif). But I am not sure we haven't missed something obvious. Best regards, Bapt