On Thu, 13 Aug 2026 07:46:26 +0000
Anurag Mandal <[email protected]> wrote:
> The RIB library named the mempool holding its nodes "MP_<name>".
> That prefix is the one the mempool library itself prepends to
> the backing memzone, so the memzone ended up named
> "MP_MP_<name>" which is improper.
>
> The FIB library passed its own name unchanged to the underlying
> RIB and did not add a prefix to the RIB name.
>
> This patch makes name each object after its owner.
> The node mempool of a RIB is now "RIB_<name>" or "RIB6_<name>",
> and the RIB owned by a FIB is now "FIB_<name>" or "FIB6_<name>".
>
> A mempool name is limited to RTE_MEMPOOL_NAMESIZE, which is much
> shorter than RTE_RIB_NAMESIZE.
> The name was passed down silently and an oversized one surfaced
> as an opaque rte_mempool_create() failure, so check the derived
> name up front and return ENAMETOOLONG instead.
> As the prefixes above are added on top of the name, the new
> maximum length of a name is limited to the following:
> RIB : 21 characters
> RIB6: 20 characters
> FIB : 17 characters
> FIB6: 15 characters
> Hence, shortening the names used by the graph nodes, the l3fwd
> example and the unit tests accordingly.
>
> Bugzilla ID: 1981 1982
> Fixes: 5a5793a5ffa2 ("rib: add RIB library")
> Fixes: f7e861e21c46 ("rib: support IPv6")
> Fixes: 39e927248416 ("fib: add FIB library")
> Fixes: 40d41a8a7b34 ("fib: support IPv6")
>
> Signed-off-by: Anurag Mandal <[email protected]>
> Acked-by: Morten Brørup <[email protected]>
> ---
This looks good, but would also like to bump up memzone size as well.
AI review:
Review: [PATCH v2] fib, rib: fix name prefixes
Applied to main (6bbb7b3) with the release notes hunk excluded; that
hunk does not apply and needs a rebase. Builds with -Dwerror=true.
rib, rib6, fib and fib6 autotests pass. Name length limits verified
with a probe program against the built libraries.
Warning
1. Fixes tags on a change that shrinks the accepted name length.
RTE_MEMPOOL_NAMESIZE is 26, so a mempool name is at most 25
characters. Before this patch the RIB mempool was "MP_<name>" and
FIB passed its name through unchanged, so RIB, RIB6, FIB and FIB6
all accepted names up to 22 characters. After this patch:
RIB 22 -> 21
RIB6 22 -> 20
FIB 22 -> 17
FIB6 22 -> 15
An application using a 16..22 character FIB6 name works on 25.11
and fails with ENAMETOOLONG after this patch. With Fixes tags the
stable maintainers will consider it for backport, which would be a
regression in an LTS.
The "MP_MP_" memzone name is cosmetic. Split into two patches:
the up-front length check with the Fixes tags (backportable, no
limit change), and the prefix rename without Fixes for 26.11 only.
2. FIB length check does not enforce the FIB limit.
rte_fib_create() and rte_fib6_create() check the prefixed name
against sizeof(mem_name), which is RTE_FIB_NAMESIZE (64). The real
limit is enforced one level down in rte_rib_create(), so an
18 character FIB name produces:
RIB: RIB name FIB_aaaaaaaaaaaaaaaaaa is too long, limit is 21
FIB: Can not allocate RIB for FIB: FIB_aaaaaaaaaaaaaaaaaa
The user never passed "FIB_..." and the stated limit is wrong for
the FIB caller (21 vs 17; 20 vs 15 for FIB6). Check against the
derived limit in FIB itself, and put the maximum name lengths in
the public headers so applications can size names without reading
release notes.
3. No test for the new ENAMETOOLONG path.
The tests were only shortened to fit. Add cases to test_rib,
test_rib6, test_fib and test_fib6 that create a name at the limit
(expect success) and at limit + 1 (expect NULL with
rte_errno == ENAMETOOLONG).
Info
4. Release notes: "name,the" is missing a space; "maximum length of
a name are" should be "is". The four limit lines are not a list in
RST and render as one run-on paragraph; use a nested bullet list.
5. "Bugzilla ID: 1981 1982" should be one tag per line.
6. The comment "Add FIB Prefix to its mempool name" in rte_fib.c and
rte_fib6.c is inaccurate; the prefixed string is the RIB name.