Skip to content

l4: ensure packet type is set before L4 processing#626

Open
rjarry wants to merge 1 commit into
DPDK:mainfrom
rjarry:l4-bad-proto
Open

l4: ensure packet type is set before L4 processing#626
rjarry wants to merge 1 commit into
DPDK:mainfrom
rjarry:l4-bad-proto

Conversation

@rjarry
Copy link
Copy Markdown
Collaborator

@rjarry rjarry commented Jun 1, 2026

The L4 nodes (l4_input_local, l4_loopback_output, ospf_redirect) use mbuf->packet_type to determine whether a packet comes from IPv4 or IPv6. However, the ip_input_local and ip6_input_local nodes never set this field explicitly before forwarding to L4. When the NIC does not classify packets or when the value is stale, L4 nodes cannot determine the correct protocol and drop the packet.

Set packet_type to RTE_PTYPE_L3_IPV4 or RTE_PTYPE_L3_IPV6 in each ip*_input_local node before stripping the IP header.

Link: #625

L4 nodes rely on mbuf->packet_type to determine whether packets originate from IPv4 or IPv6. The ip_input_local and ip6_input_local nodes did not explicitly set this field before forwarding to L4, causing packets to be dropped when NICs lack packet classification or the value is stale.

modules/ip/datapath/ip_local.c: Set mbuf->packet_type to RTE_PTYPE_L3_IPV4 after populating per-packet metadata fields (src/dst/len/vrf_id/proto/ttl) and before stripping the IPv4 header with rte_pktmbuf_adj().

modules/ip6/datapath/ip6_local.c: Set m->packet_type to RTE_PTYPE_L3_IPV6 when handling L4 protocols (IPPROTO_UDP, IPPROTO_TCP, IPPROTO_SCTP, IPPROTO_DCCP) and before checksum verification.

The L4 nodes (l4_input_local, l4_loopback_output, ospf_redirect) use
mbuf->packet_type to determine whether a packet comes from IPv4 or
IPv6. However, the ip_input_local and ip6_input_local nodes never set
this field explicitly before forwarding to L4. When the NIC does not
classify packets or when the value is stale, L4 nodes cannot determine
the correct protocol and drop the packet.

Set packet_type to RTE_PTYPE_L3_IPV4 or RTE_PTYPE_L3_IPV6 in each
ip*_input_local node before stripping the IP header.

Link: DPDK#625
Signed-off-by: Robin Jarry <rjarry@redhat.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 449905af-b298-43dd-adb8-88137c82149c

📥 Commits

Reviewing files that changed from the base of the PR and between fe0c7f9 and 3bb2c7c.

📒 Files selected for processing (2)
  • modules/ip/datapath/ip_local.c
  • modules/ip6/datapath/ip6_local.c

📝 Walkthrough

Walkthrough

This PR adds packet type annotations to the datapath for both IPv4 and IPv6 local input processing. The IPv4 path marks each matched packet as RTE_PTYPE_L3_IPV4 after populating per-packet metadata and before forwarding. The IPv6 path marks L4 protocol packets as RTE_PTYPE_L3_IPV6 during checksum verification handling. Both changes occur at single, focused points in their respective protocol stacks with no control-flow modifications.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant