Date: Fri, 2 Apr 2010 16:52:55 GMT From: Boris Astardzhiev <boris_astardzhiev@smartcom.bg> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/145300: ARP table mapping is not refreshed on a MAC address change Message-ID: <201004021652.o32GqtK6046704@www.freebsd.org> Resent-Message-ID: <201004021700.o32H0DbI084214@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 145300 >Category: kern >Synopsis: ARP table mapping is not refreshed on a MAC address change >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 02 17:00:13 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Boris Astardzhiev >Release: FreeBSD 8.0 >Organization: Smartcom Bulgaria AD >Environment: FreeBSD boris-fbsd.smartcom.bg 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #3: Tue Mar 30 18:58:50 EEST 2010 root@boris-fbsd.smartcom.bg:/usr/src/sys/i386/compile/KGDB i386 >Description: On changing a link layer (MAC) address of a network interface that has an AF_INET address family applied to it the ARP table remains untouched reporting that the AF_INET address family is still mapped to the previous MAC address. An ARP table flush does not solve the problem. >How-To-Repeat: Here's a walk-through regarding the specified problem. boris-fbsd# ifconfig em1 em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 08:00:27:07:bb:b7 inet 192.168.56.2 netmask 0xffffff00 broadcast 192.168.56.255 media: Ethernet autoselect (1000baseT <full-duplex>) status: active boris-fbsd# arp -a -n ? (192.168.56.2) at 08:00:27:07:bb:b7 on em1 permanent [ethernet] boris-fbsd# ifconfig em1 ether 11:22:33:44:55:66 boris-fbsd# ifconfig em1 em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM> ether 11:22:33:44:55:66 inet 192.168.56.2 netmask 0xffffff00 broadcast 192.168.56.255 media: Ethernet autoselect (1000baseT <full-duplex>) status: active boris-fbsd# arp -a -n ? (192.168.56.2) at 08:00:27:07:bb:b7 on em1 permanent [ethernet] boris-fbsd# arp -a -d 192.168.56.2 (192.168.56.2) deleted boris-fbsd# arp -a -n ? (192.168.56.2) at 08:00:27:07:bb:b7 on em1 permanent [ethernet] boris-fbsd# As you may have noticed the MAC address reported in the ARP table remains the old one though it's been changed. >Fix: A patch is applied. Patch attached with submission follows: --- usr/src/sys/net/if.c 2010-04-02 19:15:39.000000000 +0300 +++ /usr/src/sys/net/if.c 2010-04-02 19:16:57.000000000 +0300 @@ -142,6 +142,11 @@ static void if_attach_internal(struct ifnet *, int); static void if_detach_internal(struct ifnet *, int); +#ifdef INET +/* XXX: better way to grab access to this function? */ +extern void arp_ifscrub(struct ifnet *ifp, uint32_t addr); +#endif /* INET */ + #ifdef INET6 /* * XXX: declare here to avoid to include many inet6 related files.. @@ -3197,8 +3202,14 @@ * the address change. */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family == AF_INET) + if (ifa->ifa_addr->sa_family == AF_INET) { + struct in_ifaddr *ia = (struct in_ifaddr *)ifa; + + /* Delete previous mappings in the ARP table + * first then send a gratuitous ARP */ + arp_ifscrub(ifp, (uint32_t)(IA_SIN(ia)->sin_addr.s_addr)); arp_ifinit(ifp, ifa); + } } #endif } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004021652.o32GqtK6046704>