mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00: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:
parent
3c9a9d683f
commit
4d72eb8421
1 changed files with 9 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue