|SUCCESS| [v7] examples/l3fwd: fix RFC 1812 checks

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Nov 13 22:09:27 CET 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/172887

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-13

Info

1. examples/l3fwd/l3fwd_em.h and examples/l3fwd/l3fwd_lpm.h: the new length argument can wrap on a runt packet.

   ```c
   if (is_valid_ipv4_pkt(ipv4_hdr, m->pkt_len - sizeof(struct rte_ether_hdr),
   ```

   If `m->pkt_len` is smaller than `sizeof(struct rte_ether_hdr)`, the unsigned subtraction wraps to a very large `link_len`.
   That value then passes the `link_len < sizeof(struct rte_ipv4_hdr)` and `link_len < total_length` checks, which defeats the out-of-bounds protection the patch adds.
   In practice PMDs drop sub-minimum frames, and the Ethernet header has already been parsed before this call, so this is hardening only.
   A guard such as `m->pkt_len < sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr)` before the call would make the checks self-contained.

2. examples/l3fwd/l3fwd.h: the length checks use the total packet length, not the first segment's length.

   ```c
   if (link_len < rte_be_to_cpu_16(pkt->total_length))
   ```

   `link_len` is derived from `m->pkt_len`, the total across all segments.
   `rte_ipv4_cksum(pkt)` reads `rte_ipv4_hdr_len(pkt)` contiguous bytes from the first segment.
   For a multi-segment mbuf whose first segment's `data_len` is shorter than the IP header with options, the checksum read can still run past the segment.
   l3fwd normally runs single-segment, so this is a note rather than a defect.

Review-Result: CLEAN


More information about the test-report mailing list