git: 6d20b6de6ae2 - stable/13 - if_epair: delete mbuf tags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Nov 2021 06:39:19 UTC
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d20b6de6ae219114049a8fd14e3bd70c10876c0 commit 6d20b6de6ae219114049a8fd14e3bd70c10876c0 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-10-26 07:57:56 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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