diff options
author | luigi <luigi@FreeBSD.org> | 2002-02-18 22:50:13 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2002-02-18 22:50:13 +0000 |
commit | 30e02147534f93971be27a9032d21bf48bb1f626 (patch) | |
tree | 59c863f9cd8865f877bc686b78df5a54c6385ef9 /sys/net | |
parent | 81d7bf4f70bbe75116f2a0427110bcd7b12857b9 (diff) | |
download | FreeBSD-src-30e02147534f93971be27a9032d21bf48bb1f626.zip FreeBSD-src-30e02147534f93971be27a9032d21bf48bb1f626.tar.gz |
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
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 8310190..a88d836 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); } |