From nobody Mon Apr 10 05:08:02 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 4PvxnG72v5z44mZB; Mon, 10 Apr 2023 05:08:02 +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 4PvxnG4Kc1z3QH4; Mon, 10 Apr 2023 05:08:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681103282; 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=QwFKhazrJlHMo6NLqVo+4hOGKHuQ0fnTHj/rv0znuQc=; b=ew/7g2OnkrtSqMo6cZQ9Gll+ALPdSrHsFKy7xdPeKxnHXGYI9uVd9+kRAxcmhiEDZb2YJA AlAP/pnlfuraoPJhaIOghVNzQhuzX3rZPPZ0+tpF7vG4r0kiNTiiNwS5z1PUJm49uiCEXN Cz0zxLkhqAqRULmSlyqH5NYUvd99GtrCUnEEKzUHirSkb9JVtOfF1+QbSG6gZooOTqKYNd ID9Y/aZyhSNJX3NRaAmPOSOLvSyyHTBdBAgaRvcMEzTarGMhHUoHO3l2j0E86KlQ+96X2V 54sWE6I6MQ1XdBLE0QPjOb1guA326SN2MadXUANBiXvwqNbipkaHv7Jr/VWOZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681103282; 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=QwFKhazrJlHMo6NLqVo+4hOGKHuQ0fnTHj/rv0znuQc=; b=NH9p4YQ5klfV3AQj+Xw8KED5BOzb07UWLBSl4o6JP2R0sz/sRzt6Tpx+0bshhfuhRMY42z Khh5ZM1xNyPjE+5E+8FqMUhDzgWocFbvJ1XzSwv3JiQpTrzG50DVOONH60/4uhTkDje4/n FKD4VdsijWxKms4HGAgsRTDLCnC1TfuvhaLhh/ibbe0O1JE2stnSSFpHsrdk1QuXT5cH19 fo7M99z3MnfE/RJp5UbuPSBeojTDXE628a5fywONMfqJGr1pO6OAbfSXMF3D/LEZS8mZjv j7kTOZbrHIyDqwu0dcIi8u517jCu8drwnI4EgcVs0GnZtX3z4+kQk1GMAQ8Vyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681103282; a=rsa-sha256; cv=none; b=uZuH1x3eYY0n3Yjqu+3GnAylIJwR3mpH6c6od6gbMt4ldOxrlYkX7BJAeIN7qLKliwZEcv 2EeWCfdvfZWF4fphh0ZQWb1r7xMw0QvZSawWqqqKC303/u5zwZ/LU1KftynOmMc9YVIo6q FA4Ccwu31RdtljvmsAArwdZik6obufrD0EWV290qioyyGnVvKAyzTeNgX2jD0YXBMLzDxB x6nFuenXbXx6km6d4aQRnD1FyRiilKQQJ6afU/TADzTpvWW+cyL18HaVbm5IoDkKUMiJeL UhFymidckO86lXXsgqJofM3mrKx2SCkiMOdczPBoVWkMVGk3xhGgPoBovj4u3A== 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 4PvxnG2Zyszcyh; Mon, 10 Apr 2023 05:08:02 +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 33A582Rh022220; Mon, 10 Apr 2023 05:08:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33A5820P022219; Mon, 10 Apr 2023 05:08:02 GMT (envelope-from git) Date: Mon, 10 Apr 2023 05:08:02 GMT Message-Id: <202304100508.33A5820P022219@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: 114126825629 - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 11412682562925064591f0abaae63e2a9ff767e5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=11412682562925064591f0abaae63e2a9ff767e5 commit 11412682562925064591f0abaae63e2a9ff767e5 Author: Zhenlei Huang AuthorDate: 2023-04-02 17:01:51 +0000 Commit: Zhenlei Huang CommitDate: 2023-04-10 05:06:22 +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) (cherry picked from commit ed44ba413c544c0aa05b3456bc430c816a0e3168) --- 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 b970e1a9f2b1..796aa7f24dcd 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -1953,12 +1953,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; + } } LAGG_RUNLOCK(); @@ -1981,12 +1983,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; + } } LAGG_RUNLOCK();