Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jun 2012 22:09:04 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r237670 - in stable/9: sbin/ifconfig sys/net
Message-ID:  <201206272209.q5RM94nk035567@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Wed Jun 27 22:09:04 2012
New Revision: 237670
URL: http://svn.freebsd.org/changeset/base/237670

Log:
  MFC r236178
  
   if_lagg: allow to invoke SIOCSLAGGPORT multiple times in a row

Modified:
  stable/9/sbin/ifconfig/iflagg.c
  stable/9/sys/net/if_lagg.c
Directory Properties:
  stable/9/sbin/ifconfig/   (props changed)
  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/sbin/ifconfig/iflagg.c
==============================================================================
--- stable/9/sbin/ifconfig/iflagg.c	Wed Jun 27 22:06:42 2012	(r237669)
+++ stable/9/sbin/ifconfig/iflagg.c	Wed Jun 27 22:09:04 2012	(r237670)
@@ -40,7 +40,8 @@ setlaggport(const char *val, int d, int 
 	strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
 	strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname));
 
-	if (ioctl(s, SIOCSLAGGPORT, &rp))
+	/* Don't choke if the port is already in this lagg. */
+	if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST)
 		err(1, "SIOCSLAGGPORT");
 }
 

Modified: stable/9/sys/net/if_lagg.c
==============================================================================
--- stable/9/sys/net/if_lagg.c	Wed Jun 27 22:06:42 2012	(r237669)
+++ stable/9/sys/net/if_lagg.c	Wed Jun 27 22:09:04 2012	(r237670)
@@ -516,8 +516,13 @@ lagg_port_create(struct lagg_softc *sc, 
 		return (ENOSPC);
 
 	/* Check if port has already been associated to a lagg */
-	if (ifp->if_lagg != NULL)
+	if (ifp->if_lagg != NULL) {
+		/* Port is already in the current lagg? */
+		lp = (struct lagg_port *)ifp->if_lagg;
+		if (lp->lp_softc == sc)
+			return (EEXIST);
 		return (EBUSY);
+	}
 
 	/* XXX Disallow non-ethernet interfaces (this should be any of 802) */
 	if (ifp->if_type != IFT_ETHER)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206272209.q5RM94nk035567>