From b2c08f43d0c69d20ff6e537698bdfbf523f168bb Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Mon, 18 Feb 2002 22:50:13 +0000 Subject: [PATCH] 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 --- sys/net/if.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 83101906c6b..a88d8361fb1 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -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); }