From owner-freebsd-bugs@FreeBSD.ORG Fri Apr 2 17:00:20 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D962E1065690 for ; Fri, 2 Apr 2010 17:00:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 1B35C8FC1D for ; Fri, 2 Apr 2010 17:00:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o32H0DrH084215 for ; Fri, 2 Apr 2010 17:00:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o32H0DbI084214; Fri, 2 Apr 2010 17:00:13 GMT (envelope-from gnats) Resent-Date: Fri, 2 Apr 2010 17:00:13 GMT Resent-Message-Id: <201004021700.o32H0DbI084214@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Boris Astardzhiev Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04E62106566B for ; Fri, 2 Apr 2010 16:52:56 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E7BDC8FC17 for ; Fri, 2 Apr 2010 16:52:55 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o32GqtVV046705 for ; Fri, 2 Apr 2010 16:52:55 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o32GqtK6046704; Fri, 2 Apr 2010 16:52:55 GMT (envelope-from nobody) Message-Id: <201004021652.o32GqtK6046704@www.freebsd.org> Date: Fri, 2 Apr 2010 16:52:55 GMT From: Boris Astardzhiev To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/145300: ARP table mapping is not refreshed on a MAC address change X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Apr 2010 17:00:21 -0000 >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 metric 0 mtu 1500 options=9b ether 08:00:27:07:bb:b7 inet 192.168.56.2 netmask 0xffffff00 broadcast 192.168.56.255 media: Ethernet autoselect (1000baseT ) 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 metric 0 mtu 1500 options=9b ether 11:22:33:44:55:66 inet 192.168.56.2 netmask 0xffffff00 broadcast 192.168.56.255 media: Ethernet autoselect (1000baseT ) 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: