|WARNING| [RFC,5/5] app/test-fib: add lookup across a group of FIBs

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Tue Nov 24 19:32:37 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173137

_AI Code Review_

warning: review has no Review-Result line, severity inferred from prose (response may be truncated)
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-24

**Patch 3/5: fib: add group of FIBs with bulk lookup across them**

**Error: ABI break in a stable public structure**

```
 	unsigned int flags; /**< Optional feature flags from RTE_FIB_F_* */
+	/** Group the FIB belongs to (NULL = no group) */
+	struct rte_fib_group *group;
 };
```

`struct rte_fib_conf` is part of the stable `rte_fib_create()` API in an installed header. This patch adds a member to it, and `rte_fib_create()` now reads it:

```
+	if ((conf->group != NULL) && ((conf->type != conf->group->type) ||
```

An application built against the previous ABI passes a smaller structure. The library would then read uninitialized memory past its end and dereference it as `conf->group`. Patches 1/2 and 2/2 only fix the in-tree callers.

Either defer this to an ABI-breaking release with a deprecation notice, or avoid changing `rte_fib_conf`. For example, add an experimental `rte_fib_group_add(grp, fib)` or `rte_fib_create_in_group()` instead.

**Warning: negative `n` is not rejected**

```
+	FIB_RETURN_IF_TRUE(((grp == NULL) || (dps == NULL) || (ips == NULL) ||
+		(next_hops == NULL) || (grp->lookup == NULL)), -EINVAL);
+
+	grp->lookup(dps, ips, next_hops, n);
```

`n` is an `int` but the lookup callbacks take `const unsigned int n`. A negative `n` converts to a huge count, so the loop reads and writes far beyond the caller's arrays. Add `n < 0` to the argument check, or make the parameter unsigned in this new API.

**Warning: no release notes for the new API**

The patch adds four experimental API functions (`rte_fib_group_create`, `rte_fib_group_free`, `rte_fib_group_lookup_bulk`, `rte_fib_group_select_lookup`) and a new conf field. The current release notes are not updated; please add an entry.

**Info: group reference count is not thread-safe**

```
+	if (--grp->refcnt == 0)
+		rte_free(grp);
```

The count is a plain non-atomic counter. The API documents that create and free must be serialized by the caller, so this is acceptable. Using `rte_atomic_fetch_sub_explicit()` would make it robust if multiple FIBs of a group are ever freed from different threads.

**Patch 5/5: app/test-fib: add lookup across a group of FIBs**

**Error: resources leak on every error path in `run_v4_group()`**

The group, the `fibs`/`fib_ids`/`dps` arrays, and any FIBs already created are never freed on error. For example:

```
+	ret = rte_fib_group_select_lookup(grp, lookup_types[config.lookup_fn]);
+	if (ret != 0) {
+		printf("Can not init lookup function\n");
+		return ret;
+	}
```

This leaks `grp`. Likewise, when one of the three allocations fails, the `return -ENOMEM` leaks the other two and `grp`. The `return -rte_errno` / `return -ret` exits inside the FIB-create loop, the lookup loop and the "FAIL" check also leak FIBs `0..j` and all the tables.

Use a single cleanup label that frees created FIBs, the group and the arrays. `rte_free


More information about the test-report mailing list