From nobody Fri Nov 19 06:39:19 2021 X-Original-To: dev-commits-src-all@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 B9DA3188B96C; Fri, 19 Nov 2021 06:39:19 +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 4HwRpb47sLz3jJh; Fri, 19 Nov 2021 06:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 55AFE23ACE; Fri, 19 Nov 2021 06:39:19 +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 1AJ6dJmI097104; Fri, 19 Nov 2021 06:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AJ6dJHU097103; Fri, 19 Nov 2021 06:39:19 GMT (envelope-from git) Date: Fri, 19 Nov 2021 06:39:19 GMT Message-Id: <202111190639.1AJ6dJHU097103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6d20b6de6ae2 - stable/13 - if_epair: delete mbuf tags List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6d20b6de6ae219114049a8fd14e3bd70c10876c0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d20b6de6ae219114049a8fd14e3bd70c10876c0 commit 6d20b6de6ae219114049a8fd14e3bd70c10876c0 Author: Kristof Provost AuthorDate: 2021-10-26 07:57:56 +0000 Commit: Kristof Provost CommitDate: 2021-11-19 05:51:58 +0000 if_epair: delete mbuf tags Remove all (non-persistent) tags when we transmit a packet. Real network interfaces do not carry any tags either, and leaving tags attached can produce unexpected results. Reviewed by: bz, glebius MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32663 (cherry picked from commit 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e) --- sys/net/if_epair.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c index 3cef6c76a2e2..2feefedb3cd9 100644 --- a/sys/net/if_epair.c +++ b/sys/net/if_epair.c @@ -195,6 +195,19 @@ struct epair_dpcpu { }; DPCPU_DEFINE(struct epair_dpcpu, epair_dpcpu); +static void +epair_clear_mbuf(struct mbuf *m) +{ + /* Remove any CSUM_SND_TAG as ether_input will barf. */ + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { + m_snd_tag_rele(m->m_pkthdr.snd_tag); + m->m_pkthdr.snd_tag = NULL; + m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; + } + + m_tag_delete_nonpersistent(m); +} + static void epair_dpcpu_init(void) { @@ -434,6 +447,8 @@ epair_start_locked(struct ifnet *ifp) } DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); + epair_clear_mbuf(m); + /* * Add a reference so the interface cannot go while the * packet is in transit as we rely on rcvif to stay valid. @@ -555,6 +570,9 @@ epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) (void)epair_add_ifp_for_draining(ifp); return (error); } + + epair_clear_mbuf(m); + sc = oifp->if_softc; /* * Add a reference so the interface cannot go while the