From nobody Sat Apr 18 12:32:26 2026 X-Original-To: dev-commits-src-all@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 4fyWNV3NDVz6ZfCk for ; Sat, 18 Apr 2026 12:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fyWNV2sVVz4NQb for ; Sat, 18 Apr 2026 12:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776515546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DP9oagxwbn3UNddH9WcrKTeuOZEazWlP6stI57zgL8o=; b=DBH/z5X2eKazPC+cu8+i96NAsn/mux1CC/fDEEvYXC4m9FxHZCpTvnTfFZ4PZ9rgCpIs0D eVywlznFq8lgiug1U+4PdHgHfZiUWxu0uKYjxLn+tDB5TpVVXtPIyQi3Q1+WXk02KfY6Jn 0fbxlDWsEOkaLRTpKmOswBXOTyFx/wqM5fPILwIh2BkOhfiR6Ko5Y8y3aqL3mSQYRA+Gl4 y1d0+p2ugs+7jCVt53mqcWTpqlA4vSSp2D1THQ2gwB239U+mJmdo0HGvlWWVRVEC0s0z4l kEk4pnO+QaGSnzv9DU4Q3g9PvLLZ8cQWeokHyNImI3sDln3RyQc5hb3uTbSDPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776515546; a=rsa-sha256; cv=none; b=mTTWnzMnFLEsJOrRmd6adJzLUAUNEIemOHJd5Y1I+za+Qj75FMNiC8E1+SMYwNn48I/wgY gIAPKPQu/3uQWmiEDMrq6JaRM7/4uUT3OOVQ1WBjJEgB7SsK+qAavzs8OvImkR+Fd/tfj9 MSkV9lgcZzJL1d20WzV3rHkemoSZAAaw4L2j/Hv1I3ZMbyTGQGcqP4N5z6qIQgYhssFoOf KVrjz1E3rV44LkfFqUIl+aPpYHMLfy+HU5tsQvdpjIfDny4AavivrI0509rRceO264Yi0z Rpt0MVRjS78RfDbWIOV+7ZGv99smQzA43BIXcw70A6KjMCadm9uEdj16bQrBfQ== 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=1776515546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DP9oagxwbn3UNddH9WcrKTeuOZEazWlP6stI57zgL8o=; b=LwvIy4WUtj4o5X6hdo+IVmq8axrfKlwBgDwIoOEBDIUgN85zxvYLqXCboZW0WvWwPeHeVX tBSp5ZebqSQBwfyJXc71oYZYoltFwCtpGPnt64o7OKfRTUsOkXOD2blQ060JgtqEyAH34K muXGrDySL0d2xq5nn1vJpdie4wU24k3gMpXP5NHA8eVFCBYLH1pcq3UdNSf4x1UxL+GCSI voKuQ5Qrr8zzIdY0kXW1kEZPsbw3vTNkpkwdjoyIUCW62BdwLbRQE/hqcPRKKINkmDhI2s /u4VCXpR9HqoRHPbKxmObzUgcuYxz6WZDodo/PWGVHaIcDX2Y7Hbgr1g2t2tNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fyWNV2Sq2zh6D for ; Sat, 18 Apr 2026 12:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3e95f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 18 Apr 2026 12:32:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 2b264cb802b9 - main - routing: Initialize V_rt_numfibs earlier during boot List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b264cb802b9b45306b1f3dfd3e9d4edfb23b2f6 Auto-Submitted: auto-generated Date: Sat, 18 Apr 2026 12:32:26 +0000 Message-Id: <69e379da.3e95f.60e70da7@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2b264cb802b9b45306b1f3dfd3e9d4edfb23b2f6 commit 2b264cb802b9b45306b1f3dfd3e9d4edfb23b2f6 Author: Mark Johnston AuthorDate: 2026-04-18 12:20:00 +0000 Commit: Mark Johnston CommitDate: 2026-04-18 12:26:16 +0000 routing: Initialize V_rt_numfibs earlier during boot V_rt_numfibs can be set at compile time (with the ROUTETABLES kernel config option) or boot time (with the net.fibs tunable). vnet_rtables_init(), running during SI_PROTO_DOMAIN, was checking the tunable and updating V_rt_numfibs accordingly, but that means that earlier SYSINITs, such as vnet_mroute_init(), see the compile-time value for V_rt_numfibs before it gets corrected in vnet_rtables_init(). Fix this by initializing V_rt_numfibs earlier, so that SYSINITs are less likely to use the wrong value. Add a comment describing the weird, preexisting semantic of resetting rt_numfibs to 1 in VNET jails. PR: 294510 Reviewed by: glebius, zlei, pouria MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56473 --- sys/net/route/route_tables.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index 571f1db9c40d..0a865079f6f2 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -83,7 +83,7 @@ VNET_DEFINE_STATIC(struct sx, rtables_lock); VNET_DEFINE_STATIC(struct rib_head **, rt_tables); #define V_rt_tables VNET(rt_tables) -VNET_DEFINE(uint32_t, _rt_numfibs) = RT_NUMFIBS; +VNET_DEFINE(uint32_t, _rt_numfibs) = 1; /* * Handler for net.my_fibnum. @@ -290,17 +290,25 @@ grow_rtables(uint32_t num_tables) } static void -vnet_rtables_init(const void *unused __unused) +rtnumfibs_init(const void *unused __unused) { int num_rtables_base; - if (IS_DEFAULT_VNET(curvnet)) { - num_rtables_base = RT_NUMFIBS; - TUNABLE_INT_FETCH("net.fibs", &num_rtables_base); - V_rt_numfibs = normalize_num_rtables(num_rtables_base); - } else - V_rt_numfibs = 1; + /* + * Set the number of FIBs based on compile-time and boot-time settings. + * For some reason, VNET jails do not inherit this parameter, so they + * must set net.fibs manually. + */ + num_rtables_base = RT_NUMFIBS; + TUNABLE_INT_FETCH("net.fibs", &num_rtables_base); + V_rt_numfibs = normalize_num_rtables(num_rtables_base); +} +SYSINIT(rtnumfibs_init, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, rtnumfibs_init, + NULL); +static void +vnet_rtables_init(const void *unused __unused) +{ vnet_rtzone_init(); #ifdef FIB_ALGO vnet_fib_init();