Skip to content

Commit 6de8d63

Browse files
committed
net/neighbor: Skip Neighbor request if ip address is invalid at ipv6
Supports no Neighbor request for invalid routing addresses in cross-segment communication Signed-off-by: zhangkai25 <[email protected]>
1 parent ea31cea commit 6de8d63

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

net/icmpv6/icmpv6_neighbor.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ int icmpv6_neighbor(FAR struct net_driver_s *dev,
257257

258258
net_ipv6addr_copy(lookup, dev->d_ipv6draddr);
259259
#endif
260+
261+
if (net_is_addr_unspecified(lookup))
262+
{
263+
return -EHOSTUNREACH;
264+
}
260265
}
261266

262267
/* No ARP packet if this device do not support ARP */

net/neighbor/neighbor_ethernet_out.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ void neighbor_ethernet_out(FAR struct net_driver_s *dev)
135135

136136
net_ipv6addr_copy(ipaddr, dev->d_ipv6draddr);
137137
#endif
138+
139+
if (net_is_addr_unspecified(ipaddr))
140+
{
141+
dev->d_len = 0;
142+
return;
143+
}
138144
}
139145
else
140146
{

0 commit comments

Comments
 (0)