From nobody@FreeBSD.org  Thu Sep 24 13:42:44 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F211106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Sep 2009 13:42:44 +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 2E0168FC15
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Sep 2009 13:42:44 +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 n8ODgh60072159
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 24 Sep 2009 13:42:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n8ODghF8072158;
	Thu, 24 Sep 2009 13:42:43 GMT
	(envelope-from nobody)
Message-Id: <200909241342.n8ODghF8072158@www.freebsd.org>
Date: Thu, 24 Sep 2009 13:42:43 GMT
From: Mykhaylo <mclone@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: removing IP alias doesn't delete permanent arp entry
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         139113
>Category:       kern
>Synopsis:       [arp] removing IP alias doesn't delete permanent arp entry
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    qingli
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 24 13:50:00 UTC 2009
>Closed-Date:    Fri Dec 04 18:56:22 UTC 2009
>Last-Modified:  Fri Dec 04 18:56:22 UTC 2009
>Originator:     Mykhaylo
>Release:        RELENG_8
>Organization:
Xata
>Environment:
FreeBSD Ch.TigerNet.com.ua 8.0-RC1 FreeBSD 8.0-RC1 #0: Tue Sep 22 06:05:59 EEST 2009     bogon@Trango.local:/usr/obj/usr/src/sys/Trango  amd64
>Description:
I wanted to change IP address on client laptop (FreeBSD 8.0-BETA4 #3: Wed Sep  9 15:22:34 EEST 2009 amd64), but noticed i forgot to remove this ip from the same interface on gateway that i was connected too (famous "is using my ip address" woe). I switched client IP back, ssh'ed gateway and removed offending alias, When i tried to use this IP again, there were no no ARP replies from gateway. Then i ssh'ed to gateway another time, and i saw there still was permanent arp entry in gateway's arp table for an IP alias i just removed. 

Issuing "arp -d <deleted.alias.ip>" did not help - arp(8) reported successfull deletion, but there was still this permanent entry in arp table.

So there is no way to delete permanent arp table entry on host, for an IP which was this host's IP alias.

Workaround is to reload if_re module and reconfigure the NIC.

>How-To-Repeat:
18:53 combiner@Ch:~> ifconfig
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether 00:1f:d0:26:67:6a
        inet 94.231.187.10 netmask 0xfffffffc broadcast 94.231.187.11
        media: Ethernet 10baseT/UTP <full-duplex>
        status: active
re1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether 00:1f:d0:26:6d:9a
        inet 10.35.52.254 netmask 0xffffff00 broadcast 10.35.52.255
        inet 10.35.52.42 netmask 0xffffff00 broadcast 10.35.52.255
        inet 10.35.52.252 netmask 0xffffff00 broadcast 10.35.52.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8149<UP,LOOPBACK,RUNNING,PROMISC,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
pfsync0: flags=0<> metric 0 mtu 1460
        syncpeer: 224.0.0.240 maxupd: 128
pflog0: flags=0<> metric 0 mtu 33152
18:56 combiner@Ch:~> s ifconfig re1 delete 10.35.52.42
18:56 combiner@Ch:~> ifconfig
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether 00:1f:d0:26:67:6a
        inet 94.231.187.10 netmask 0xfffffffc broadcast 94.231.187.11
        media: Ethernet 10baseT/UTP <full-duplex>
        status: active
re1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
        ether 00:1f:d0:26:6d:9a
        inet 10.35.52.254 netmask 0xffffff00 broadcast 10.35.52.255
        inet 10.35.52.252 netmask 0xffffff00 broadcast 10.35.52.255
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
lo0: flags=8149<UP,LOOPBACK,RUNNING,PROMISC,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
pfsync0: flags=0<> metric 0 mtu 1460
        syncpeer: 224.0.0.240 maxupd: 128
pflog0: flags=0<> metric 0 mtu 33152
18:57 combiner@Ch:~> arp0
? (10.35.52.252) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (10.35.52.222) at 00:a0:d1:96:bb:09 on re1 [ethernet]
? (10.35.52.254) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (10.35.52.42) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (94.231.187.10) at 00:1f:d0:26:67:6a on re0 permanent [ethernet]
? (94.231.187.9) at 00:02:b3:25:f8:ec on re0 [ethernet]
18:58 combiner@Ch:~> s arp -d 10.35.52.42
10.35.52.42 (10.35.52.42) deleted
18:59 combiner@Ch:~> arp0
? (10.35.52.252) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (10.35.52.222) at 00:a0:d1:96:bb:09 on re1 [ethernet]
? (10.35.52.254) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (10.35.52.42) at 00:1f:d0:26:6d:9a on re1 permanent [ethernet]
? (94.231.187.10) at 00:1f:d0:26:67:6a on re0 permanent [ethernet]
? (94.231.187.9) at 00:02:b3:25:f8:ec on re0 [ethernet]

>Fix:
kldunload if_re
kldload if_re
sleep 11
/etc/rc.d/netif restart
/etc/rc.d/routing restart

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 24 20:29:44 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=139113 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/139113: commit references a PR
Date: Fri,  2 Oct 2009 01:35:09 +0000 (UTC)

 Author: qingli
 Date: Fri Oct  2 01:34:55 2009
 New Revision: 197695
 URL: http://svn.freebsd.org/changeset/base/197695
 
 Log:
   Previously, if an address alias is configured on an interface, and
   this address alias has a prefix matching that of another address
   configured on the same interface, then the ARP entry for the alias
   is not deleted from the ARP table when that address alias is removed.
   This patch fixes the aforementioned issue.
   
   PR:		kern/139113
   MFC after:	3 days
 
 Modified:
   head/sys/netinet/in.c
 
 Modified: head/sys/netinet/in.c
 ==============================================================================
 --- head/sys/netinet/in.c	Fri Oct  2 01:07:28 2009	(r197694)
 +++ head/sys/netinet/in.c	Fri Oct  2 01:34:55 2009	(r197695)
 @@ -1060,6 +1060,8 @@ in_scrubprefix(struct in_ifaddr *target)
  	    !(target->ia_ifp->if_flags & IFF_LOOPBACK)) {
  		error = ifa_del_loopback_route((struct ifaddr *)target,
  				       (struct sockaddr *)&target->ia_addr);
 +		/* remove arp cache */
 +		arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
  	}
  
  	if ((target->ia_flags & IFA_ROUTE) == 0) {
 @@ -1082,8 +1084,6 @@ in_scrubprefix(struct in_ifaddr *target)
  		prefix = target->ia_addr.sin_addr;
  		mask = target->ia_sockmask.sin_addr;
  		prefix.s_addr &= mask.s_addr;
 -		/* remove arp cache */
 -		arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
  	}
  
  	IN_IFADDR_RLOCK();
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/139113: commit references a PR
Date: Tue,  6 Oct 2009 19:45:04 +0000 (UTC)

 Author: qingli
 Date: Tue Oct  6 19:44:44 2009
 New Revision: 197811
 URL: http://svn.freebsd.org/changeset/base/197811
 
 Log:
   MFC	197695
   
   Previously, if an address alias is configured on an interface, and
   this address alias has a prefix matching that of another address
   configured on the same interface, then the ARP entry for the alias
   is not deleted from the ARP table when that address alias is removed.
   This patch fixes the aforementioned issue.
   
   PR:		kern/139113
   Reviewed by:	bz
   Approved by:	re
 
 Modified:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
   stable/8/sys/netinet/in.c
 
 Modified: stable/8/sys/netinet/in.c
 ==============================================================================
 --- stable/8/sys/netinet/in.c	Tue Oct  6 18:47:02 2009	(r197810)
 +++ stable/8/sys/netinet/in.c	Tue Oct  6 19:44:44 2009	(r197811)
 @@ -1060,6 +1060,8 @@ in_scrubprefix(struct in_ifaddr *target)
  	    !(target->ia_ifp->if_flags & IFF_LOOPBACK)) {
  		error = ifa_del_loopback_route((struct ifaddr *)target,
  				       (struct sockaddr *)&target->ia_addr);
 +		/* remove arp cache */
 +		arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
  	}
  
  	if ((target->ia_flags & IFA_ROUTE) == 0) {
 @@ -1082,8 +1084,6 @@ in_scrubprefix(struct in_ifaddr *target)
  		prefix = target->ia_addr.sin_addr;
  		mask = target->ia_sockmask.sin_addr;
  		prefix.s_addr &= mask.s_addr;
 -		/* remove arp cache */
 -		arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr);
  	}
  
  	IN_IFADDR_RLOCK();
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: qingli 
State-Changed-When: Fri Dec 4 18:55:40 UTC 2009 
State-Changed-Why:  
The patch has been committed and the fix has been verified. 



Responsible-Changed-From-To: freebsd-net->qingli 
Responsible-Changed-By: qingli 
Responsible-Changed-When: Fri Dec 4 18:55:40 UTC 2009 
Responsible-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=139113 
>Unformatted:
