net: iface: Allow NULL pointer to be handled in net_if_is_ip_offloaded #61215
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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