1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

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
This commit is contained in:
Andrey V. Elsukov 2015-01-17 11:32:09 +00:00
parent df560e4e96
commit 504289ea5a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277295

View File

@ -799,11 +799,16 @@ lagg_port_create(struct lagg_softc *sc, struct ifnet *ifp)
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;
}