net/icmpv6: Discard Neighbor Discovery packet if optlen is 0

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>
This commit is contained in:
Alan Carvalho de Assis 2026-05-03 09:14:52 -03:00 committed by Alan C. Assis
parent 3c9a9d683f
commit 4d72eb8421

View file

@ -428,6 +428,15 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
FAR struct icmpv6_generic_s *opt =
(FAR struct icmpv6_generic_s *)&options[ndx];
/* RFC 4861 4.6: "The value 0 is invalid. Nodes MUST silently
* discard a packet that contains an option with length zero."
*/
if (opt->optlen == 0)
{
goto icmpv6_drop_packet;
}
switch (opt->opttype)
{
case ICMPv6_OPT_SRCLLADDR: