Skip to content

[PATCH v2] api: packet: clarify l2/l3/l4 pointer value when offset is too large#2325

Merged
MatiasElo merged 1 commit intoOpenDataPlane:masterfrom
JannePeltonen:api-pkt-invalid-layer-offset
Mar 30, 2026
Merged

[PATCH v2] api: packet: clarify l2/l3/l4 pointer value when offset is too large#2325
MatiasElo merged 1 commit intoOpenDataPlane:masterfrom
JannePeltonen:api-pkt-invalid-layer-offset

Conversation

@JannePeltonen
Copy link
Copy Markdown
Collaborator

The l2/l3/l4 offset metadata of a packet may be larger than the length of the packet e.g. after truncating the packet. Specify that in that case odp_packet_{l2,l3,l4}_ptr() can return any pointer value, including NULL, and any value for the remaining segment length.

This also implies that a returned null pointer does not necessarily mean that the offset has not been set.

Clarify that even though the offset setting functions require the offset not exceed packet data length, later packet truncation and pulling may result in the offset exceeding packet data length.

@odpbuild odpbuild changed the title api: packet: clarify l2/l3/l4 pointer value when offset is too large [PATCH v1] api: packet: clarify l2/l3/l4 pointer value when offset is too large Mar 17, 2026
Copy link
Copy Markdown
Collaborator

@psavol psavol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed API commit

@MatiasElo MatiasElo added this to the v1.50.0 milestone Mar 19, 2026
The l2/l3/l4 offset metadata of a packet may be larger than the length of
the packet e.g. after truncating the packet. Specify that in that case
odp_packet_{l2,l3,l4}_ptr() can return any pointer value, including NULL,
and any value for the remaining segment length.

This also implies that a returned null pointer does not necessarily mean
that the offset has not been set.

Clarify that even though the offset setting functions require the offset
not exceed packet data length, later packet truncation and pulling
may result in the offset exceeding packet data length.

Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
@JannePeltonen JannePeltonen force-pushed the api-pkt-invalid-layer-offset branch from 5579f3a to 8294179 Compare March 30, 2026 12:31
@odpbuild odpbuild changed the title [PATCH v1] api: packet: clarify l2/l3/l4 pointer value when offset is too large [PATCH v2] api: packet: clarify l2/l3/l4 pointer value when offset is too large Mar 30, 2026
@JannePeltonen
Copy link
Copy Markdown
Collaborator Author

v2: rebased and added review tag

@MatiasElo MatiasElo enabled auto-merge (rebase) March 30, 2026 12:35
@MatiasElo MatiasElo merged commit 0c3530f into OpenDataPlane:master Mar 30, 2026
254 of 256 checks passed
@JannePeltonen JannePeltonen deleted the api-pkt-invalid-layer-offset branch March 31, 2026 16:39
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.

3 participants