if_epair: also remove vlan metadata from mbufs

We already remove mbuf tags from packets transitting an if_epair, but we
didn't remove vlan metadata.
In certain configurations this could lead to unexpected vlan tags
turning up on the rx side.

PR:		270736
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39482
This commit is contained in:
Kristof Provost 2023-04-10 13:02:55 +02:00
parent d73acb32d3
commit c69ae84197

View File

@ -133,6 +133,8 @@ static struct epair_tasks_t epair_tasks;
static void
epair_clear_mbuf(struct mbuf *m)
{
M_ASSERTPKTHDR(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);
@ -140,6 +142,10 @@ epair_clear_mbuf(struct mbuf *m)
m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG;
}
/* Clear vlan information. */
m->m_flags &= ~M_VLANTAG;
m->m_pkthdr.ether_vtag = 0;
m_tag_delete_nonpersistent(m);
}