From nobody Sun Apr 2 17:12:21 2023 X-Original-To: dev-commits-src-main@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 4PqLDk0Xwfz43vw2; Sun, 2 Apr 2023 17:12:22 +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 4PqLDk06T2z44mF; Sun, 2 Apr 2023 17:12:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680455542; 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=lc9RkXu8jAWX2qFUH2nDGOYMq6ZwltQek0yEYkwNNPk=; b=XSLB9i5fk5s3LvEUatc9nUerVJZchrLR4byvjvJsy/sS1DgJTACRN/2FPz1GY3Sigh7wPT 1XpIdyJ+/d1VzzbXrFtMvh4whgH281hqxKpNL2m1lxZ7Uyfo3zHyNYWhNKbuy0XPo/L8Vo HgHr3n/3A9Z/JmSpRQJwL4v2RqrqlZ+adqnUWU2Xp0QGSTkkPV+7Nx+DHzbmXlC+2ba6QA lkLmY9W/HaAO5hhqZrsKtVU3weYx6b0nEIXSPaNGkqYPeIe2wlJ8wwjzKmEw6coxebg/4O ajlknLmkHKPHPsQe0yCSh2lLC70ztCN1KP8Wrskj6RwodbcSlEBbmCcld+DbgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680455542; 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=lc9RkXu8jAWX2qFUH2nDGOYMq6ZwltQek0yEYkwNNPk=; b=xa/bdot2nvy6L3KvmIjitWixSjke+YePzR+GvFlbeg+kHm0f227y4stgNzHWFxVOIBGnig /J/FlG3DTgkDZcX8pxOBA/e3vsB9yc8Hsl086U49rbsBDiNyg7eD999GS7ZzVZUDNZ4smV lEwBV6me5S3vc8QjuR4vQKtLKxEFdqoNe3O7Ywg4P4++DcjOMZB4bEIPRqmcMiCpIsqTbb Q3p30eKc1a4mHBNoRiz7ITmfWiq3rk0zb9JhvJDwZzDDEletWAD2uhRuQCg9vN7CCQ1hOn nBNiTxWv8+E3lfx/42qLMe3MHiu8v7C1cHCcQBye/Cz2HCOqSp5i72pTcra9VQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680455542; a=rsa-sha256; cv=none; b=rr6kAIYVoQ4AoolvnXnmsrCxlzrktLcib3Sz2xi2b5nHXXJ0EwP0vwDEO9yY1UrFpV98OV wdU45zvcB8dtu3sUpWJRiiqW5lpZ1V3IF/Y8nbekQ2GBwEDbT+Dv/4PGxIFd/X01ynNbwV CnHtblWFRZhu/8VEMv4/UqaGrvRXxAac68bSYDGiEi2zox2JG4MsKbgWshx9Y6K5ttn2do CFQCwTEAhhDNxVyqHbemrcyvVGpOhAC9ywAcu6FlpqyN8g5t3ckqu2GTdmoce+lV3UsPq3 A9DKsCYvow58wEYNLCAMRQgkaD2lF6Zyg0ORQux0oUzi5sADpVv7nYm+fAYu6w== 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 4PqLDj5zl9zQQh; Sun, 2 Apr 2023 17:12:21 +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 332HCLlC045661; Sun, 2 Apr 2023 17:12:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 332HCL00045660; Sun, 2 Apr 2023 17:12:21 GMT (envelope-from git) Date: Sun, 2 Apr 2023 17:12:21 GMT Message-Id: <202304021712.332HCL00045660@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 5f3d0399e903 - main - lagg(4): Tap traffic after protocol processing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 5f3d0399e903573e9648385ea6585e54af4d573f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=5f3d0399e903573e9648385ea6585e54af4d573f commit 5f3d0399e903573e9648385ea6585e54af4d573f Author: Zhenlei Huang AuthorDate: 2023-04-02 17:01:51 +0000 Commit: Zhenlei Huang CommitDate: 2023-04-02 17:01:51 +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 --- 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 b3475839a2c1..c07deb3217fa 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -2171,12 +2171,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; + } } #ifdef DEV_NETMAP @@ -2204,12 +2206,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; + } } return (m);