The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=62d2dcafb7f33fe8f47e9d5dd519d665f7af140e

commit 62d2dcafb7f33fe8f47e9d5dd519d665f7af140e
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2021-10-26 07:57:56 +0000
Commit:     Kristof Provost <k...@freebsd.org>
CommitDate: 2021-10-28 08:41:16 +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
---
 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 7f62cdb427ff..a62fbfad8771 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -196,6 +196,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)
 {
@@ -435,6 +448,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.
@@ -556,6 +571,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

Reply via email to