net/neighbor/neighbor_ethernet_out.c: fix build error without ICMPv6

Patch fixes following build error when
CONFIG_NET_IPv6 && !CONFIG_NET_ICMPv6 && CONFIG_NET_ETHERNET:

  nuttx/staging/libnet.a(neighbor_ethernet_out.o): In function `neighbor_ethernet_out':
  nuttx/net/neighbor/neighbor_ethernet_out.c:188: undefined reference to `icmpv6_solicit'

IPv6 without ICMPv6 is not very useful, but at least this patch
allows neighbor_ethernet_out() to be used with a packet socket or
with multicast address (point-to-point IPv6 links) even in that case.

Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
This commit is contained in:
Juha Niskanen 2020-11-24 17:08:32 +02:00 committed by Xiang Xiao
parent a97aefe10a
commit ebb5fb7480
1 changed files with 14 additions and 3 deletions

View File

@ -174,18 +174,28 @@ void neighbor_ethernet_out(FAR struct net_driver_s *dev)
net_ipv6addr_copy(ipaddr, ip->destipaddr);
}
/* Check if we already have this destination address in the Neighbor Table */
/* Check if we already have this destination address in the
* Neighbor Table.
*/
if (neighbor_lookup(ipaddr, &laddr) < 0)
{
#ifdef CONFIG_NET_ICMPv6
ninfo("IPv6 Neighbor solicitation for IPv6\n");
/* The destination address was not in our Neighbor Table, so we
* overwrite the IPv6 packet with an ICMDv6 Neighbor Solicitation
* overwrite the IPv6 packet with an ICMPv6 Neighbor Solicitation
* message.
*/
icmpv6_solicit(dev, ipaddr);
#else
/* What to do here? We need the laddr, but no way to get it. */
nerr("ERROR: IPv6 needs link layer address for ethernet.\n");
DEBUGPANIC();
return;
#endif
}
}
@ -198,7 +208,8 @@ void neighbor_ethernet_out(FAR struct net_driver_s *dev)
}
else
{
memcpy(eth->dest, laddr.u.na_ethernet.ether_addr_octet, ETHER_ADDR_LEN);
memcpy(eth->dest, laddr.u.na_ethernet.ether_addr_octet,
ETHER_ADDR_LEN);
}
/* Finish populating the Ethernet header */