Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jan 2015 11:32:09 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277295 - head/sys/net
Message-ID:  <201501171132.t0HBW9Lq096680@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Sat Jan 17 11:32:09 2015
New Revision: 277295
URL: https://svnweb.freebsd.org/changeset/base/277295

Log:
  Fix condition and really sort ports. Also add comment describing
  the intent of this code.
  
  Reported by:	sbruno
  MFC after:	1 week
  Sponsored by:	Yandex LLC

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==============================================================================
--- head/sys/net/if_lagg.c	Sat Jan 17 08:35:31 2015	(r277294)
+++ head/sys/net/if_lagg.c	Sat Jan 17 11:32:09 2015	(r277295)
@@ -799,11 +799,16 @@ lagg_port_create(struct lagg_softc *sc, 
 		lagg_port_lladdr(lp, IF_LLADDR(sc->sc_ifp));
 	}
 
-	/* Insert into the list of ports. Keep ports sorted by if_index. */
+	/*
+	 * Insert into the list of ports.
+	 * Keep ports sorted by if_index. It is handy, when configuration
+	 * is predictable and `ifconfig laggN create ...` command
+	 * will lead to the same result each time.
+	 */
 	SLIST_FOREACH(tlp, &sc->sc_ports, lp_entries) {
 		if (tlp->lp_ifp->if_index < ifp->if_index && (
 		    SLIST_NEXT(tlp, lp_entries) == NULL ||
-		    SLIST_NEXT(tlp, lp_entries)->lp_ifp->if_index <
+		    SLIST_NEXT(tlp, lp_entries)->lp_ifp->if_index >
 		    ifp->if_index))
 			break;
 	}



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