From nobody Mon Apr 10 04:16:48 2023 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 4Pvwf82W3Rz44kYT; Mon, 10 Apr 2023 04:16:48 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pvwf81lJgz4Mpy; Mon, 10 Apr 2023 04:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681100208; 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=zZO2qHhplhWP5l6VRscPq5blnH135ya7Ha5QLYw6CJc=; b=wwzwpeQC6b8fHz9e+DJfFElkByv64o/dcbFnsxxwErz2pdK4tWawoTI/arjEkDEbhxuRvX gFRf5ZKZ0S/FUcYc57bPnC77FhVCMf/nHYsgwXMBW1SVbH9bcKHJnK34qv4fDdodBMgGmn KSkJZ6kGw/AGqlfdaZt/XVb5x6sQBCqfV5rFRGahTvf5K+DBMZA9FRr3MSskK/sYXbftxn 4mjMlvqTtL5SeDhDRZMOCtJhjQbRhKA7XNJ/Dkt03NRg7oRw68T5/FVmBzpB6GySs4fvGR Ott25W5hgE0K2OB5upMOaEPk39AuH1ioZ7jriXc4PoQAMqB+vRnkLLlq9p7SVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681100208; 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=zZO2qHhplhWP5l6VRscPq5blnH135ya7Ha5QLYw6CJc=; b=dmj8pjpmLmpiyOsamN0hsxkWDA5KwaMdJ7j8KPEsTAHrLdpWgg4QaoxSZ5VrdsJaXJMsqh 5/7stlNjVmvb+XNJZbQD5N/bDEKlWO2ETVLHkKg8gP4pIsMFK8tQglqnCO8pGLvtPPJfLz PN04pn1LHr6A5E8GnAMRe0hfW6nJ/0ouCcDSm8DZNwvlIkHwTl4EEkFSYVJFVtiZyVoARA QSv5rdH4+iaWl73Yu8rUehxWZnHubO2R3t0exuudLI4+wOHLfIwzFMyHZtDyk0JMJKvQG2 7FvCaSD1JDbsAsHmFcDfkK5uSaNVsHgA6Q3s+S4L2XzB2fQ6POPjmKEfbS/wqA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681100208; a=rsa-sha256; cv=none; b=QxchdFLJpZH3Tow8YTtNd80EQ/jruxYL5rqsJ/7Ai6+QTTDbzdnJmSm/V54sU4N9NXi2Hy u9DDM6f4LH2nQ4L/ZxuVO8JRuhwoApUiaoNLfwtBkcgMMPZEqtIfWUHAyVLSrhIepwo5Bf DbtCdcmJk1btkZzYwEYroAagMuZmXmYtzbbxI76SAybnZgFwhttJIp3lUrAL/gZReiPn/g qNv00ABq7PWKPiwmvIrf+zkGj+t8RMvmm0cK68ABAvG3PuMXzkzsgf7kZomsNhclpfcusR q86PirJv222A9fFRn05ztX0tHx2IDxLBMOpWlwdS21aPX1JsEE3wJQqoYwDdvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pvwf80pXFzbmG; Mon, 10 Apr 2023 04:16:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33A4GmP9039620; Mon, 10 Apr 2023 04:16:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33A4GmZS039619; Mon, 10 Apr 2023 04:16:48 GMT (envelope-from git) Date: Mon, 10 Apr 2023 04:16:48 GMT Message-Id: <202304100416.33A4GmZS039619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: ed44ba413c54 - stable/13 - lagg(4): Tap traffic after protocol processing 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: 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/13 X-Git-Reftype: branch X-Git-Commit: ed44ba413c544c0aa05b3456bc430c816a0e3168 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=ed44ba413c544c0aa05b3456bc430c816a0e3168 commit ed44ba413c544c0aa05b3456bc430c816a0e3168 Author: Zhenlei Huang AuthorDate: 2023-04-02 17:01:51 +0000 Commit: Zhenlei Huang CommitDate: 2023-04-10 04:15:04 +0000 lagg(4): Tap traffic after protocol processing Different lagg protocols have different means and policies to process incoming traffic. For example, for failover protocol, by default received traffic is only accepted when they are received through the active port. For lacp protocol, LACP control messages are tapped off, also traffic will be dropped if they are received through the port which is not in collecting state or is not joined to the active aggregator. It confuses if user dump and see inbound traffic on lagg(4) interfaces but they are actually silently dropped and not passed into the net stack. Tap traffic after protocol processing so that user will have consistent view of the inbound traffic, meanwhile mbuf is set with correct receiving interface and bpf(4) will diagnose the right direction of inbound packets. PR: 270417 Reviewed by: melifaro (previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39225 (cherry picked from commit 5f3d0399e903573e9648385ea6585e54af4d573f) --- sys/net/if_lagg.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 74f8c41a125e..3bbcb4f8e4cd 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -2070,12 +2070,14 @@ lagg_input_ethernet(struct ifnet *ifp, struct mbuf *m) return (NULL); } - ETHER_BPF_MTAP(scifp, m); - m = lagg_proto_input(sc, lp, m); - if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { - m_freem(m); - m = NULL; + if (m != NULL) { + ETHER_BPF_MTAP(scifp, m); + + if ((scifp->if_flags & IFF_MONITOR) != 0) { + m_freem(m); + m = NULL; + } } return (m); @@ -2098,12 +2100,14 @@ lagg_input_infiniband(struct ifnet *ifp, struct mbuf *m) return (NULL); } - INFINIBAND_BPF_MTAP(scifp, m); - m = lagg_proto_input(sc, lp, m); - if (m != NULL && (scifp->if_flags & IFF_MONITOR) != 0) { - m_freem(m); - m = NULL; + if (m != NULL) { + INFINIBAND_BPF_MTAP(scifp, m); + + if ((scifp->if_flags & IFF_MONITOR) != 0) { + m_freem(m); + m = NULL; + } } NET_EPOCH_EXIT(et);