mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 14:46:01 +00:00
Fix bug #55972: The Neighbour Solicitation used to do IPv6 address resolution was wrong
Apply patch from Gao Qingshui
This commit is contained in:
parent
4f6fd6c845
commit
aa7009b2fc
|
@ -1187,10 +1187,22 @@ nd6_send_ns(struct netif *netif, const ip6_addr_t *target_addr, u8_t flags)
|
||||||
|
|
||||||
LWIP_ASSERT("target address is required", target_addr != NULL);
|
LWIP_ASSERT("target address is required", target_addr != NULL);
|
||||||
|
|
||||||
if (!(flags & ND6_SEND_FLAG_ANY_SRC) &&
|
if (!(flags & ND6_SEND_FLAG_ANY_SRC)) {
|
||||||
ip6_addr_isvalid(netif_ip6_addr_state(netif,0))) {
|
int i;
|
||||||
/* Use link-local address as source address. */
|
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
|
||||||
src_addr = netif_ip6_addr(netif, 0);
|
if (ip6_addr_isvalid(netif_ip6_addr_state(netif, i)) &&
|
||||||
|
ip6_addr_netcmp(target_addr, netif_ip6_addr(netif, i))) {
|
||||||
|
src_addr = netif_ip6_addr(netif, i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == LWIP_IPV6_NUM_ADDRESSES) {
|
||||||
|
LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_WARNING, ("ICMPv6 NS: no available src address\n"));
|
||||||
|
ND6_STATS_INC(nd6.err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* calculate option length (in 8-byte-blocks) */
|
/* calculate option length (in 8-byte-blocks) */
|
||||||
lladdr_opt_len = ((netif->hwaddr_len + 2) + 7) >> 3;
|
lladdr_opt_len = ((netif->hwaddr_len + 2) + 7) >> 3;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user