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

Fix LWIP crash on unexpected ping packets #2159

Merged
merged 1 commit into from
May 15, 2024
Merged

Fix LWIP crash on unexpected ping packets #2159

merged 1 commit into from
May 15, 2024

Conversation

earlephilhower
Copy link
Owner

When a ping is sent from the Pico, a raw_recv callback is added which sees all raw incoming packets to detect the response from the ping target. If while waiting for the target response an external ping packet arrives this incoming ping request packet will be processed by the LwipIntfDev<>::_pingCB which will return "0" not processed and which should not change the payload unless it handles the actual packet.

Unfortunately, the 20 byte header was unconditionally stripped off of the packet before checking if this was our response, changing the payload address and causing an assertion in LWIP.

Fix by using absolute offsets inside the raw packet for the ping response checks.

Fixes #2156
Fixes #2149

When a ping is sent from the Pico, a raw_recv callback is added which
sees all raw incoming packets to detect the response from the ping target.
If while waiting for the target response an external ping packet arrives
this incoming ping request packet will be processed by the
LwipIntfDev<>::_pingCB which will return "0" not processed and which
*should* not change the payload unless it handles the actual packet.

Unfortunately, the 20 byte header was unconditionally stripped off of
the packet before checking if this was our response, changing the
payload address and causing an assertion in LWIP.

Fix by using absolute offsets inside the raw packet for the ping
response checks.

Fixes #2156
Fixes #2149
@earlephilhower earlephilhower merged commit d4cdb3e into master May 15, 2024
13 checks passed
@earlephilhower earlephilhower deleted the nopoop branch May 15, 2024 00:37
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.

Hang with Pico W when using a W5500 and WiFi at the same time.
1 participant