From nobody Wed Feb 11 10:03:13 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4f9vBn30qnz6SM7G for ; Wed, 11 Feb 2026 10:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4f9vBn14qDz49Yr for ; Wed, 11 Feb 2026 10:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770804193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N9oKi/OP0CvFqr1CP070p+46h/ted8hjVf3FKmyJTS4=; b=Zx27g88TZp8nW3j0eD5JmMAfmWjx/cdwjE0aGDCJ4WHgKlO+JBrhEfTTUpOv/9a2//2NXw 7bLKfB1HTFEs3XA6o3XoTG2no/QdfjD4Hp4+RHIA8OrF2PJqSM+AAyjV3EnkBIICuOXf+h zdoGn3bswS0nNmaSLOMlEIBUN2KKQn/J2+/G0TYy7QlxLMf7GIJOLDkhZjit9OYym5Z4GO hIycqYrf4iFfUhwVoMMJF+v06jxXB3gJOdOutirfgtKjaXuRly99A66wYzJbir7dJ7h/He VGBozDRJ9sEhITYIVAl4A1xxANwJ2u1BXXzYSIybMNVxuDuya+BVMTGbKBZHqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1770804193; a=rsa-sha256; cv=none; b=p3v2iLXyWcOWChV+K0L2DUBr7bVVXitPDw2jFOC2mc/HHJgUv94DhpWBSrHD7j9HfAa67t RqFuwszY+zpQGXm3kR32whkiSExDUUb4yH9XyfDS1ce/p9qlNx3W9u3hqVQbA4nvDC4i0B pRA5Ov4kYpYJBTpdtZ57G+4LGT33gV2EuF7xSYKp6sVRDq8uJ9bwQWWnP9KoZ4ZqlhWn4H bZV+zso7Aia5mVx8vPoUULk13TzdKgqdWJuJ48j+q/flbLbA7Bzg2kJLLYrM2exrylI0CH 4dwpiC8gxXUlOhBPFYNOYfVPFGDrj1GMoaj2UafTs0AgtJ34XoitHtLM2ThjnQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1770804193; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N9oKi/OP0CvFqr1CP070p+46h/ted8hjVf3FKmyJTS4=; b=mYCjpMTqZ0oFfLRdh9rGIir0aWOX2Fq5zvyEkPe6aGeh3/3joDqK0vSTM46IyWxi0VaYGX Te51J2kzGpP1s+XC16r4qTI+RYrg0/VK9ws8Ap7RB3unopj/HA+FApqDRhvF8zeFxKxk0s vpiQkoIATktyQdIJHA0QHFtEUtvXnOfObnx09XDL3cJTwB+xvImXn6yoEBEArB4lSUSqlL D/UIIIrI/ycffpntYiatmIp0E5iD/D5QE2Iw4fLHek4iYhaatHSQyIcRF5MVXSYuIRQjie rtAABbh7LDWTLInH8LVgniX1vXSPFJ23HP8CR8ZZqNNgATkuhF3HolusiAoRIQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4f9vBn0fjNzlRW for ; Wed, 11 Feb 2026 10:03:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c08b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 11 Feb 2026 10:03:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 18c70c737cb3 - stable/15 - lagg: Make the none protocol a first-class citizen List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 18c70c737cb3e488e2658add19134f455add294d Auto-Submitted: auto-generated Date: Wed, 11 Feb 2026 10:03:13 +0000 Message-Id: <698c53e1.1c08b.7a9c880b@gitrepo.freebsd.org> The branch stable/15 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=18c70c737cb3e488e2658add19134f455add294d commit 18c70c737cb3e488e2658add19134f455add294d Author: Zhenlei Huang AuthorDate: 2026-02-06 03:37:43 +0000 Commit: Zhenlei Huang CommitDate: 2026-02-11 10:00:44 +0000 lagg: Make the none protocol a first-class citizen All the other protocols have corresponding start and input routines, which are used in the fast path. Currently the none protocol is treated specially. In the fast path it is checked to indicate whether a working protocol is configured. There are two issues raised by this design: 1. In production, other protocols are commonly used, but not the none protocol. It smells like an overkill to always check it in the fast path. It is unfair to other commonly used protocols. 2. PR 289017 reveals that there's a small window between checking the protocol and calling lagg_proto_start(). lagg_proto_start() is possible to see the none protocol and do NULL deferencing. Fix them by making the none protocol a first-class citizen so that it has start and input routines just the same as other protocols. Then we can stop checking it in the fast path, since lagg_proto_start() and lagg_proto_input() will never fail to work. The error ENETDOWN is chosen for the start routine. Obviously no active ports are available, and the packets will go nowhere. It is also a better error than ENXIO, since indeed the interface is configured and has a TX algorithm (the none protocol). PR: 289017 Diagnosed by: Qiu-ji Chen Tested by: Gui-Dong Han Reviewed by: glebius MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D55123 (cherry picked from commit a622030b4baec2136984cea7bd25c2985a2ae9b3) --- sys/net/if_lagg.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 5b52bfa80e3b..21ea2b30459b 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -169,6 +169,11 @@ static void lagg_media_status(struct ifnet *, struct ifmediareq *); static struct lagg_port *lagg_link_active(struct lagg_softc *, struct lagg_port *); +/* No proto */ +static int lagg_none_start(struct lagg_softc *, struct mbuf *); +static struct mbuf *lagg_none_input(struct lagg_softc *, struct lagg_port *, + struct mbuf *); + /* Simple round robin */ static void lagg_rr_attach(struct lagg_softc *); static int lagg_rr_start(struct lagg_softc *, struct mbuf *); @@ -219,7 +224,9 @@ static const struct lagg_proto { void (*pr_portreq)(struct lagg_port *, void *); } lagg_protos[] = { { - .pr_num = LAGG_PROTO_NONE + .pr_num = LAGG_PROTO_NONE, + .pr_start = lagg_none_start, + .pr_input = lagg_none_input, }, { .pr_num = LAGG_PROTO_ROUNDROBIN, @@ -2129,8 +2136,8 @@ lagg_transmit_ethernet(struct ifnet *ifp, struct mbuf *m) if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) MPASS(m->m_pkthdr.snd_tag->ifp == ifp); #endif - /* We need a Tx algorithm and at least one port */ - if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) { + /* We need at least one port */ + if (sc->sc_count == 0) { m_freem(m); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENXIO); @@ -2151,8 +2158,8 @@ lagg_transmit_infiniband(struct ifnet *ifp, struct mbuf *m) if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) MPASS(m->m_pkthdr.snd_tag->ifp == ifp); #endif - /* We need a Tx algorithm and at least one port */ - if (sc->sc_proto == LAGG_PROTO_NONE || sc->sc_count == 0) { + /* We need at least one port */ + if (sc->sc_count == 0) { m_freem(m); if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); return (ENXIO); @@ -2180,8 +2187,7 @@ lagg_input_ethernet(struct ifnet *ifp, struct mbuf *m) NET_EPOCH_ASSERT(); if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - lp->lp_detaching != 0 || - sc->sc_proto == LAGG_PROTO_NONE) { + lp->lp_detaching != 0) { m_freem(m); return (NULL); } @@ -2215,8 +2221,7 @@ lagg_input_infiniband(struct ifnet *ifp, struct mbuf *m) NET_EPOCH_ASSERT(); if ((scifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || - lp->lp_detaching != 0 || - sc->sc_proto == LAGG_PROTO_NONE) { + lp->lp_detaching != 0) { m_freem(m); return (NULL); } @@ -2390,6 +2395,25 @@ lagg_enqueue(struct ifnet *ifp, struct mbuf *m) return (ifp->if_transmit)(ifp, m); } +/* + * No proto + */ +static int +lagg_none_start(struct lagg_softc *sc, struct mbuf *m) +{ + m_freem(m); + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); + /* No active ports available */ + return (ENETDOWN); +} + +static struct mbuf * +lagg_none_input(struct lagg_softc *sc, struct lagg_port *lp, struct mbuf *m) +{ + m_freem(m); + return (NULL); +} + /* * Simple round robin aggregation */