From nobody Sun Aug 16 20:25:19 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 4hNSBl5QT3z6pYVq for ; Sun, 16 Aug 2026 20:25:19 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hNSBl3c7Yz3x0l for ; Sun, 16 Aug 2026 20:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1786911919; 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=b8TEzCerG158FuA7ibqjeDf6kEW22akw7e6FscsTsvI=; b=bUI4JBL6w/9yY7xsfRjMllS//JFdYHfunBR8y72zbMlKKTwMG4tTGFOOscIFRxlMC+fxmW fd9jzHo1MsdiL5f0gqczJ52lecpzELnzYyAoJa7p/lRQPXlBzLd9kQSI8cpIvKQL5lzhwZ zKzCsL4t4Q8rW6s/BtOnF0YW0peUujiOcd35RGotbi+Y7y2bkh3+PP3EJs84O5aAKPNja8 h3ZH4PNtf7tzOEMzXSmV0tmSJ5uQQZuvdJBWgu9Ja1pXATMAXL5fb9o3CsTsC7ipllnc4N TULlaYwd45bWNLjNJry1x9OAu/lTxBW0ki840W0niktzLfxkXO6rw4S1Fjd3nA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1786911919; a=rsa-sha256; cv=none; b=Ca/+R5wFhQvBIKiy0dR85zRZBnZD/xw1PBTgP1Lbe/feUPUW7yDVQqRht6X6oi5m6Eh5Fi iA6qndZBZrJwAJj1rZly0i/5EpjVciSs2FjNNvT0dB7fQ5k3bK60jAll3eN4qit7qTXQLP XjFFSTU7es/5Yo7NvYV6ZGc+U2TLxzcUdpGgXqq3ah4XhcDeuTYaaHijWigpsHApWU/Paq sw5XsLCKuUiaxYnLaFm6Aw7wF0fP4MivJKE+808IfrLvv+/6Z4ZuLKFq8rJ1jEfPlm/acz lKy9cIpLF2POga4LHhqBTOAHRA06UakVvSXFIuVgU5vOIZgarbXuuDx3Yb6Whg== 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=1786911919; 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=b8TEzCerG158FuA7ibqjeDf6kEW22akw7e6FscsTsvI=; b=V3Ii1jEJt2/F5K2Vp/fIJLUUVpUnpjRerdbtxBJeZiGskgM6WiJL2RnTQ/xmg9kRRnLdyL 0XInD0c3nNlGbZB+1MBv7N1pejJpwkQWZdFoiXugfzatVBcQh2fLWFfAW3Xyrci0g5bMN3 0e0XCzqvJ1GMytGA6GIlZ4NNQ+eKcqVf9yB2uce2ZpTX1+61+JKgNEFymkqxOKvs/pw8Aa P+aqz/U9Mj2smuYmdNTP51LepvKxT2AtHDPTQ2HROc/0+TkLwA0DcEeCfC45jt9UKNH9wq WAlXa80uM4/I5iTJUxcMxvkHRQwICpH23d0f00bWfvux7e+mNeeNmuLyrqE4Sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hNSBl2LNXzkWZ for ; Sun, 16 Aug 2026 20:25:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 454d8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 16 Aug 2026 20:25:19 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: fde12de2c686 - stable/14 - routing: Fix table sizes 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fde12de2c686e49d75629dabb226066cb055374e Auto-Submitted: auto-generated Date: Sun, 16 Aug 2026 20:25:19 +0000 Message-Id: <6a821caf.454d8.7c299c9a@gitrepo.freebsd.org> The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=fde12de2c686e49d75629dabb226066cb055374e commit fde12de2c686e49d75629dabb226066cb055374e Author: Dag-Erling Smørgrav AuthorDate: 2026-08-13 21:45:53 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-08-16 20:25:00 +0000 routing: Fix table sizes Tables that have one element per protocol or address family were previously sized by AF_MAX + 1 since AF_MAX was off by one. Now that AF_MAX has been corrected, we need to apply the opposite correction to these tables. Fixes: ddd850aa7720 ("sys/socket.h: Fix AF_MAX") MFC after: 3 days Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: pouria, kevans, glebius Differential Revision: https://reviews.freebsd.org/D58826 (cherry picked from commit 6c41d928bcd763ec60d55bec2886c05b03cf9e6a) --- sys/net/route/route_tables.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/net/route/route_tables.c b/sys/net/route/route_tables.c index fb3cef4bda83..22c65810bf59 100644 --- a/sys/net/route/route_tables.c +++ b/sys/net/route/route_tables.c @@ -204,7 +204,7 @@ static void populate_kernel_routes(struct rib_head **new_rt_tables, struct rib_head *rh) { for (int i = 0; i < V_rt_numfibs; i++) { - struct rib_head *rh_src = new_rt_tables[i * (AF_MAX + 1) + rh->rib_family]; + struct rib_head *rh_src = new_rt_tables[i * AF_MAX + rh->rib_family]; if ((rh_src != NULL) && (rh_src != rh)) rib_copy_kernel_routes(rh_src, rh); } @@ -229,7 +229,7 @@ grow_rtables(uint32_t num_tables) KASSERT(num_tables >= V_rt_numfibs, ("num_tables(%u) < rt_numfibs(%u)\n", num_tables, V_rt_numfibs)); - new_rt_tables = mallocarray(num_tables * (AF_MAX + 1), sizeof(void *), + new_rt_tables = mallocarray(num_tables * AF_MAX, sizeof(void *), M_RTABLE, M_WAITOK | M_ZERO); if (num_tables > 1 && V_rt_add_addr_allfibs == 0 && !printedonce) { @@ -245,12 +245,12 @@ grow_rtables(uint32_t num_tables) /* * Current rt_tables layout: - * fib0[af0, af1, af2, .., AF_MAX]fib1[af0, af1, af2, .., Af_MAX].. + * fib0[af0, af1, af2, .., AF_MAX-1]fib1[af0, af1, af2, .., AF_MAX-1].. * this allows to copy existing tables data by using memcpy() */ if (V_rt_tables != NULL) memcpy(new_rt_tables, V_rt_tables, - V_rt_numfibs * (AF_MAX + 1) * sizeof(void *)); + V_rt_numfibs * AF_MAX * sizeof(void *)); /* Populate the remainders */ SLIST_FOREACH(dom, &domains, dom_next) { @@ -258,7 +258,7 @@ grow_rtables(uint32_t num_tables) continue; family = dom->dom_family; for (int i = 0; i < num_tables; i++) { - prnh = &new_rt_tables[i * (AF_MAX + 1) + family]; + prnh = &new_rt_tables[i * AF_MAX + family]; if (*prnh != NULL) continue; rh = dom->dom_rtattach(i); @@ -380,13 +380,13 @@ rt_tables_get_rnh_ptr(uint32_t table, sa_family_t family) KASSERT(table < V_rt_numfibs, ("%s: table out of bounds (%d < %d)", __func__, table, V_rt_numfibs)); - KASSERT(family < (AF_MAX + 1), - ("%s: fam out of bounds (%d < %d)", __func__, family, AF_MAX + 1)); + KASSERT(family < AF_MAX, + ("%s: fam out of bounds (%d < %d)", __func__, family, AF_MAX)); /* rnh is [fib=0][af=0]. */ prnh = V_rt_tables; /* Get the offset to the requested table and fam. */ - prnh += table * (AF_MAX + 1) + family; + prnh += table * AF_MAX + family; return (*prnh); } @@ -403,7 +403,7 @@ rt_tables_get_rnh_safe(uint32_t table, sa_family_t family) { if (__predict_false(table >= V_rt_numfibs)) return (NULL); - if (__predict_false(family >= (AF_MAX + 1))) + if (__predict_false(family >= AF_MAX)) return (NULL); return (rt_tables_get_rnh_ptr(table, family)); }