Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: iface: Allow NULL pointer to be handled in net_if_is_ip_offloaded #61215

Conversation

rlubos
Copy link
Contributor

@rlubos rlubos commented Aug 7, 2023

In case native interface is used with NET_OFFLOAD enabled, the net_if_is_ip_offloaded() could lead to a crash, if called on unbound net_context (i.e. with no iface assigned to net_context yet).

As since commit 40d2240 the net_context allocated on offloaded interface is always assigned with the iface pointer during its creation, it can be safely assumed that in case of NULL pointer is provided we deal with a native interface. Therefore instead of asserting on the iface pointer, indicate that the interface is native when NULL pointer is provided.

Fixes #61173

In case native interface is used with NET_OFFLOAD enabled, the
net_if_is_ip_offloaded() could lead to a crash, if called on unbound
net_context (i.e. with no iface assigned to net_context yet).

As since commit 40d2240 the net_context
allocated on offloaded interface is always assigned with the iface
pointer during its creation, it can be safely assumed that in case of
NULL pointer is provided we deal with a native interface. Therefore
instead of asserting on the iface pointer, indicate that the interface
is native when NULL pointer is provided.

Signed-off-by: Robert Lubos <[email protected]>
@fabiobaltieri fabiobaltieri merged commit 32bd3aa into zephyrproject-rtos:main Aug 8, 2023
21 checks passed
@jukkar jukkar added the backport v3.4-branch Backport to the v3.4-branch label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking backport v3.4-branch Backport to the v3.4-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

net: regression on native IP stack when an offload driver is present
5 participants