diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-01-17 11:32:09 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-01-17 11:32:09 +0000 |
commit | 504289ea5a4700e7cda5fc08e25364842eb95df6 (patch) | |
tree | b27887ebb248257514592e31cbedf275933048d9 | |
parent | df560e4e96c4c52ad7555b486c68962a59b1bd64 (diff) | |
download | src-504289ea5a4700e7cda5fc08e25364842eb95df6.tar.gz src-504289ea5a4700e7cda5fc08e25364842eb95df6.zip |
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
Notes
Notes:
svn path=/head/; revision=277295
-rw-r--r-- | sys/net/if_lagg.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 45315b6b3b55..a6e5b3c65a1f 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -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; } |