From nobody@FreeBSD.org  Fri Jun 29 20:57:00 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id E4C651065672
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Jun 2012 20:57:00 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id B67638FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Jun 2012 20:57:00 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q5TKv0Nv082214
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 29 Jun 2012 20:57:00 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q5TKv01L082213;
	Fri, 29 Jun 2012 20:57:00 GMT
	(envelope-from nobody)
Message-Id: <201206292057.q5TKv01L082213@red.freebsd.org>
Date: Fri, 29 Jun 2012 20:57:00 GMT
From: Mark Johnston <markjdb@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch][lagg] handle interface renames
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         169557
>Category:       kern
>Synopsis:       [patch][lagg] handle interface renames
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    thompsa
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 29 21:00:22 UTC 2012
>Closed-Date:    Tue Jul 03 01:47:57 UTC 2012
>Last-Modified:  Tue Jul  3 01:50:12 UTC 2012
>Originator:     Mark Johnston
>Release:        CURRENT
>Organization:
Sandvine Inc.
>Environment:
$ uname -a
FreeBSD oddish 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r237569+921e55b: Mon Jun 25 17:56:13 EDT 2012     mark@oddish:/home/mark/src/obj/usr/home/mark/src/freebsd/sys/GENERIC  amd64
>Description:
Renaming an interface that's part of a lagg will cause if_lagg(4) to remove it from the group. This is because if_lagg(4) sees the interface's departure event and assumes it's leaving forever. With a rename, this isn't the case.
>How-To-Repeat:
# ifconfig lagg0 create
# ifconfig lagg0 laggproto failover laggport re0
# ifconfig re0
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether f0:de:f1:9c:8e:a9
        inet 192.168.200.21 netmask 0xfffffe00 broadcast 192.168.201.255 
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
# ifconfig lagg0
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether f0:de:f1:9c:8e:a9
        inet 192.168.200.21 netmask 0xfffffe00 broadcast 192.168.201.255 
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        laggproto failover lagghash l2,l3,l4
        laggport: re0 flags=5<MASTER,ACTIVE>
# ifconfig re0 name foo0
# ifconfig lagg0
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:00:00:00:00:00
        inet 192.168.200.21 netmask 0xfffffe00 broadcast 192.168.201.255 
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
        laggproto failover lagghash l2,l3,l4
>Fix:
Apply the patch. There is an identical check in the corresponding function for if_vlan(4).

Patch attached with submission follows:

diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 9041e18..af2fdbc 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -797,6 +797,8 @@ lagg_port_ifdetach(void *arg __unused, struct ifnet *ifp)
 
 	if ((lp = ifp->if_lagg) == NULL)
 		return;
+	if (ifp->if_flags & IFF_RUNNING)
+		return;
 
 	sc = lp->lp_softc;
 


>Release-Note:
>Audit-Trail:

From: Mark Johnston <markjdb@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/169557: [patch][lagg] handle interface renames
Date: Fri, 29 Jun 2012 17:15:00 -0400

 --mYCpIKhGyMATD0i+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Argh, this is what I get for manually copying the patch to the tree on
 my laptop. =(
 
 I'm checking the wrong flag in the above patch. The attached patch
 corrects it.
 
 Thanks,
 -Mark
 
 --mYCpIKhGyMATD0i+
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="lagg_handle_rename.patch.txt"
 
 diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
 index 9041e18..503e76e 100644
 --- a/sys/net/if_lagg.c
 +++ b/sys/net/if_lagg.c
 @@ -797,6 +797,8 @@ lagg_port_ifdetach(void *arg __unused, struct ifnet *ifp)
  
  	if ((lp = ifp->if_lagg) == NULL)
  		return;
 +	if (ifp->if_flags & IFF_RENAMING)
 +		return;
  
  	sc = lp->lp_softc;
  
 
 --mYCpIKhGyMATD0i+--
State-Changed-From-To: open->patched 
State-Changed-By: thompsa 
State-Changed-When: Sat Jun 30 19:09:16 UTC 2012 
State-Changed-Why:  
Committed, awaiting MFC. Thanks for the PR. 


Responsible-Changed-From-To: freebsd-bugs->thompsa 
Responsible-Changed-By: thompsa 
Responsible-Changed-When: Sat Jun 30 19:09:16 UTC 2012 
Responsible-Changed-Why:  
Committed, awaiting MFC. Thanks for the PR. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/169557: commit references a PR
Date: Sat, 30 Jun 2012 19:09:17 +0000 (UTC)

 Author: thompsa
 Date: Sat Jun 30 19:09:02 2012
 New Revision: 237852
 URL: http://svn.freebsd.org/changeset/base/237852
 
 Log:
   Add the same check as vlan(4) where we ignore the ifnet departure event if the
   interface is just being renamed.
   
   PR:		kern/169557
   Submitted by:	Mark Johnston
   MFC after:	3 days
 
 Modified:
   head/sys/net/if_lagg.c
 
 Modified: head/sys/net/if_lagg.c
 ==============================================================================
 --- head/sys/net/if_lagg.c	Sat Jun 30 18:58:21 2012	(r237851)
 +++ head/sys/net/if_lagg.c	Sat Jun 30 19:09:02 2012	(r237852)
 @@ -797,6 +797,9 @@ lagg_port_ifdetach(void *arg __unused, s
  
  	if ((lp = ifp->if_lagg) == NULL)
  		return;
 +	/* If the ifnet is just being renamed, don't do anything. */
 +	if (ifp->if_flags & IFF_RENAMING)
 +		return;
  
  	sc = lp->lp_softc;
  
 _______________________________________________
 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: patched->closed 
State-Changed-By: thompsa 
State-Changed-When: Tue Jul 3 01:47:30 UTC 2012 
State-Changed-Why:  
Merged to 8 & 9, thanks for the patch. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/169557: commit references a PR
Date: Tue,  3 Jul 2012 01:45:40 +0000 (UTC)

 Author: thompsa
 Date: Tue Jul  3 01:45:28 2012
 New Revision: 238047
 URL: http://svn.freebsd.org/changeset/base/238047
 
 Log:
   MFC r237852
   
    Add the same check as vlan(4) where we ignore the ifnet departure event if the
    interface is just being renamed.
   
   PR:		kern/169557
 
 Modified:
   stable/9/sys/net/if_lagg.c
 Directory Properties:
   stable/9/sys/   (props changed)
   stable/9/sys/amd64/include/xen/   (props changed)
   stable/9/sys/boot/   (props changed)
   stable/9/sys/boot/i386/efi/   (props changed)
   stable/9/sys/boot/ia64/efi/   (props changed)
   stable/9/sys/boot/ia64/ski/   (props changed)
   stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
   stable/9/sys/boot/powerpc/ofw/   (props changed)
   stable/9/sys/cddl/contrib/opensolaris/   (props changed)
   stable/9/sys/conf/   (props changed)
   stable/9/sys/contrib/dev/acpica/   (props changed)
   stable/9/sys/contrib/octeon-sdk/   (props changed)
   stable/9/sys/contrib/pf/   (props changed)
   stable/9/sys/contrib/x86emu/   (props changed)
   stable/9/sys/dev/   (props changed)
   stable/9/sys/dev/e1000/   (props changed)
   stable/9/sys/dev/isp/   (props changed)
   stable/9/sys/dev/ixgbe/   (props changed)
   stable/9/sys/fs/   (props changed)
   stable/9/sys/fs/ntfs/   (props changed)
   stable/9/sys/modules/   (props changed)
 
 Modified: stable/9/sys/net/if_lagg.c
 ==============================================================================
 --- stable/9/sys/net/if_lagg.c	Tue Jul  3 01:00:29 2012	(r238046)
 +++ stable/9/sys/net/if_lagg.c	Tue Jul  3 01:45:28 2012	(r238047)
 @@ -797,6 +797,9 @@ lagg_port_ifdetach(void *arg __unused, s
  
  	if ((lp = ifp->if_lagg) == NULL)
  		return;
 +	/* If the ifnet is just being renamed, don't do anything. */
 +	if (ifp->if_flags & IFF_RENAMING)
 +		return;
  
  	sc = lp->lp_softc;
  
 _______________________________________________
 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/169557: commit references a PR
Date: Tue,  3 Jul 2012 01:46:05 +0000 (UTC)

 Author: thompsa
 Date: Tue Jul  3 01:45:38 2012
 New Revision: 238048
 URL: http://svn.freebsd.org/changeset/base/238048
 
 Log:
   MFC r237852
   
    Add the same check as vlan(4) where we ignore the ifnet departure event if the
    interface is just being renamed.
   
   PR:		kern/169557
 
 Modified:
   stable/8/sys/net/if_lagg.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/boot/   (props changed)
   stable/8/sys/cddl/   (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/e1000/   (props changed)
 
 Modified: stable/8/sys/net/if_lagg.c
 ==============================================================================
 --- stable/8/sys/net/if_lagg.c	Tue Jul  3 01:45:28 2012	(r238047)
 +++ stable/8/sys/net/if_lagg.c	Tue Jul  3 01:45:38 2012	(r238048)
 @@ -784,6 +784,9 @@ lagg_port_ifdetach(void *arg __unused, s
  
  	if ((lp = ifp->if_lagg) == NULL)
  		return;
 +	/* If the ifnet is just being renamed, don't do anything. */
 +	if (ifp->if_flags & IFF_RENAMING)
 +		return;
  
  	sc = lp->lp_softc;
  
 _______________________________________________
 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"
 
>Unformatted:
