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: core: Do IPv4/6 packet checks only for those packet types #87328

Conversation

jukkar
Copy link
Member

@jukkar jukkar commented Mar 19, 2025

The check_ip() in net_core.c did not check that the packet Ethernet type is either IPv4 or IPv6. This meant that we for example checked TTL also for ARP packets which is pointless as those are not IPv4 packets.

Fix this by checking the link layer protocol type of the packet to be either IPv4 or IPv6 before doing L3 checks.

Fixes #87327

The check_ip() in net_core.c did not check that the packet
Ethernet type is either IPv4 or IPv6. This meant that we for
example checked TTL also for ARP packets which is pointless as
those are not IPv4 packets.

Fix this by checking the link layer protocol type of the packet
to be either IPv4 or IPv6 before doing L3 checks.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
@jukkar jukkar added the backport v4.1-branch Request backport to the v4.1-branch label Mar 19, 2025
pdgendt
pdgendt previously approved these changes Mar 19, 2025
rlubos
rlubos previously approved these changes Mar 19, 2025
@jukkar jukkar dismissed stale reviews from rlubos and pdgendt via 20c32e3 March 19, 2025 11:33
@jukkar
Copy link
Member Author

jukkar commented Mar 19, 2025

  • CI fixes

@jukkar jukkar requested review from pdgendt and rlubos March 19, 2025 12:01
The test_send_ipv6_fragment_without_hbho() test did not set link layer
protocol type for the packet. It is needed in this case because we
are sending a ready made packet and the protocol type is unknown
otherwise.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
@jukkar jukkar force-pushed the fix/87327/ll-ptype-not-checked-in-sending branch from 20c32e3 to a3771cb Compare March 20, 2025 06:19
@jukkar
Copy link
Member Author

jukkar commented Mar 20, 2025

  • Fixed the commit log of the latest commit (function name was wrong in the log)

@kartben kartben merged commit 7752def into zephyrproject-rtos:main Mar 21, 2025
22 checks passed
@jukkar jukkar deleted the fix/87327/ll-ptype-not-checked-in-sending branch March 21, 2025 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking backport v4.1-branch Request backport to the v4.1-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong IPv4 and IPv6 fields are checked for sent packet
5 participants