mirror of
https://github.com/apache/nuttx.git
synced 2026-08-24 06:58:27 +00:00
net/arp: Skip ARP request if ip address is invalid
Supports no ARP reply for invalid routing addresses in cross-segment communication Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
This commit is contained in:
parent
0a381a3ff7
commit
711c58767a
2 changed files with 10 additions and 0 deletions
|
|
@ -224,6 +224,12 @@ void arp_out(FAR struct net_driver_s *dev)
|
|||
|
||||
net_ipv4addr_copy(ipaddr, dev->d_draddr);
|
||||
#endif
|
||||
|
||||
if (ipaddr == INADDR_ANY)
|
||||
{
|
||||
dev->d_len = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* The destination address is on the local network. Check if it is
|
||||
|
|
|
|||
|
|
@ -254,6 +254,10 @@ int arp_send(in_addr_t ipaddr)
|
|||
net_ipv4addr_copy(dripaddr, dev->d_draddr);
|
||||
#endif
|
||||
ipaddr = dripaddr;
|
||||
if (ipaddr == INADDR_ANY)
|
||||
{
|
||||
return -EHOSTUNREACH;
|
||||
}
|
||||
}
|
||||
|
||||
/* The destination address is on the local network. Check if it is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue