net/icmpv6: Discard Neighbor Discovery packet if optlen is 0#18843
Conversation
This commit make ICMPv6 on NuttX compliant with RFC4861 ignoring a Neighbor Discovery packet when its optlen is 0. Signed-off-by: Alan C. Assis <acassis@gmail.com>
|
@ankohuu yes, others ND msg also should be checked according with RFC 4861, so ICMPv6_NEIGHBOR_SOLICIT and ICMPv6_NEIGHBOR_ADVERTISE also should be checked (I will send a new PR to fix). But differently from ICMPV6_ROUTER_ADVERTISE they check only a single option (so no loop). That loop was causing an issue that could stall the devices.
You are right, if ndx + sizeof(struct icmpv6_generic_s) > optlen then we will have an OOB, I will fix it as well. Thank you very much!
Yes, unfortunately the RFC is ambiguous, it only said that I need to discard a packet with optlen 0. Fortunately my solution already fixes it because I do a "goto icmpv6_drop_packet" that will exit the entire loop. |
Before drop, |
Hmm, you are right, I think I should change the generic option header first, I will add this check: Do you see any other issue? |
Summary
This commit make ICMPv6 on NuttX compliant with RFC4861 ignoring a DN packet when its optlen is 0.
Impact
Make NuttX compliant with RFC 4861.
Testing
Using sim:nettest
In another Linux terminal: