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;
        }
_______________________________________________
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-unsubscr...@freebsd.org"

Reply via email to