Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion net/icmpv6/icmpv6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <nuttx/net/netstats.h>
#include <nuttx/net/icmpv6.h>
#include <nuttx/net/dns.h>
#include <inet/inet.h>

#include "devif/devif.h"
#include "netlink/netlink.h"
Expand Down Expand Up @@ -332,7 +333,7 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
case ICMPv6_NEIGHBOR_ADVERTISE:
{
FAR struct icmpv6_neighbor_advertise_s *adv;

bool should_process = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: use a more explicit name, it helps people that will read this code in the future. I suggest using "is_for_this_node" instead of "should_process". Although in the "else" it tests for allnodes the packet needs to be handle locally. Other option could be "is_local_or_allnodes_dest"

/* If the IPv6 destination address matches our address, and if so,
* add the neighbor address mapping to the list of neighbors.
*
Expand All @@ -344,6 +345,16 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)

adv = ICMPv6ADVERTISE;
if (NETDEV_IS_MY_V6ADDR(dev, ipv6->destipaddr))
{
should_process = true;
}
else if (net_ipv6addr_cmp(ipv6->destipaddr, g_ipv6_allnodes))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not merge into one if statement

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this idea was to detect if received some NA and print display it

{
should_process = true;
ninfo("Received NA to all-nodes multicast address\n");
}

if (should_process)
{
/* This message is required to support the Target link-layer
* address option.
Expand Down
Loading