Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Apr 2023 04:16:48 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ed44ba413c54 - stable/13 - lagg(4): Tap traffic after protocol processing
Message-ID:  <202304100416.33A4GmZS039619@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=ed44ba413c544c0aa05b3456bc430c816a0e3168

commit ed44ba413c544c0aa05b3456bc430c816a0e3168
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2023-04-02 17:01:51 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304100416.33A4GmZS039619>