mirror of
https://github.com/apache/nuttx.git
synced 2026-08-20 22:24:52 +08:00
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:
committed by
Alan C. Assis
parent
3c9a9d683f
commit
4d72eb8421
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user