When the local link address is changed, send out gratuitous ARPs

to notify other nodes about the address change. Otherwise, they
might try and keep using the old address until their arp table
entry times out and the address is refreshed.

Maybe this ought to be done for INET6 addresses as well but i have
no idea how to do it. It should be pretty straightforward though.

MFC-after: 10 days
This commit is contained in:
Luigi Rizzo 2002-02-18 22:50:13 +00:00
parent dcafc12e41
commit b2c08f43d0

View File

@ -1819,6 +1819,17 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
(*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL);
ifp->if_flags |= IFF_UP;
(*ifp->if_ioctl)(ifp, SIOCSIFFLAGS, NULL);
#ifdef INET
/*
* Also send gratuitous ARPs to notify other nodes about
* the address change.
*/
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
if (ifa->ifa_addr != NULL &&
ifa->ifa_addr->sa_family == AF_INET)
arp_ifinit((struct arpcom *)ifp, ifa);
}
#endif
}
return (0);
}