Support to ARP Address Conflict Detection

Support to ARP Address Conflict Detection

Signed-off-by: wangchen <wangchen41@xiaomi.com>
This commit is contained in:
wangchen
2024-01-22 10:20:46 +08:00
committed by Alan Carvalho de Assis
parent a188cf3480
commit 204f4a18a0
10 changed files with 532 additions and 3 deletions
+15
View File
@@ -982,6 +982,11 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
/* Yes.. bring the interface up */
ret = netdev_ifup(dev);
#ifdef CONFIG_NET_ARP_ACD
/* having address then start acd */
arp_acd_setup(dev);
#endif /* CONFIG_NET_ARP_ACD */
}
/* Is this a request to take the interface down? */
@@ -1080,9 +1085,19 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
#ifdef CONFIG_NET_IPv4
if (psock->s_domain != PF_INET6)
{
if (net_ipv4addr_cmp(dev->d_ipaddr,
((FAR struct sockaddr_in *)&req->ifr_addr)->sin_addr.s_addr))
{
break;
}
ioctl_set_ipv4addr(&dev->d_ipaddr, &req->ifr_addr);
netlink_device_notify_ipaddr(dev, RTM_NEWADDR, AF_INET,
&dev->d_ipaddr, net_ipv4_mask2pref(dev->d_netmask));
#ifdef CONFIG_NET_ARP_ACD
arp_acd_set_addr(dev);
#endif /* CONFIG_NET_ARP_ACD */
}
#endif