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

icmp: Fixed replies to broadcasts. #6262

Merged
merged 1 commit into from
May 13, 2022
Merged

Conversation

fjpanag
Copy link
Contributor

@fjpanag fjpanag commented May 13, 2022

Summary

ICMP must not reply to broadcasts.

Currently, it is improperly checking whether the destination is a broadcast, by a pure equality check with INADDR_BROADCAST.
The broadcast address, as defined by the subnet mask, is not checked. This results in ICMP replying to broadcasts that it shouldn't.

The fix also takes into account the subnet mast, and checks against the calculated broadcast address, ensuring that only valid responses are sent.

Impact

There are no more ICMP responses to broadcasts.

Testing

Tested on a custom target, based on the STM32F427, using the LAN8720A.

Traffic was examined with Wireshark, with and without the fix, validating the fix.

@xiaoxiang781216 xiaoxiang781216 merged commit 8ef20c2 into apache:master May 13, 2022
@fjpanag fjpanag deleted the icmp_reply branch May 13, 2022 12:31
@hartmannathan
Copy link
Contributor

For future reference, this change was discussed in the NuttX mail list thread "ICMP responses on UDP broadcasts" started 10 May 2022, archived at https://lists.apache.org/thread/qly6hbt63bxocdorc2kk173nys1vgkvt and other places.

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