aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-11-10 16:52:07 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2022-06-10 18:57:51 +0200
commitdad3e685f5b97b286c150eb21e727ec446aaefd2 (patch)
tree7c146a49e19d63a9ada4911e3c698fc1fb6a9412
parentwg_cookie: ratelimit_init: use callout_init_mtx (diff)
downloadwireguard-freebsd-dad3e685f5b97b286c150eb21e727ec446aaefd2.tar.xz
wireguard-freebsd-dad3e685f5b97b286c150eb21e727ec446aaefd2.zip
if_wg: wg_mbuf_reset: don't free send tags
Send tags are only added on mbufs sent to an interface which supports if_snd_tag_alloc. Just assert that they are never present instead. Signed-off-by: John Baldwin <jhb@FreeBSD.org>
-rw-r--r--src/compat.h10
-rw-r--r--src/if_wg.c6
2 files changed, 2 insertions, 14 deletions
diff --git a/src/compat.h b/src/compat.h
index 68b108c..f5b7059 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -68,16 +68,6 @@ static inline void taskqgroup_drain_all(struct taskqgroup *tqg)
#undef atomic_load_ptr
#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p))
-static inline void m_snd_tag_rele(struct m_snd_tag *mst)
-{
- struct ifnet *ifp;
- if (!mst)
- return;
- ifp = mst->ifp;
- ifp->if_snd_tag_free(mst);
- if_rele(ifp);
-}
-
#endif
#if __FreeBSD_version < 1202000
diff --git a/src/if_wg.c b/src/if_wg.c
index ab0b464..8910a0b 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -1478,10 +1478,8 @@ wg_mbuf_reset(struct mbuf *m)
m_tag_delete(m, t);
}
- if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) {
- m_snd_tag_rele(m->m_pkthdr.snd_tag);
- m->m_pkthdr.snd_tag = NULL;
- }
+ KASSERT((m->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0,
+ ("%s: mbuf %p has a send tag", __func__, m));
m->m_pkthdr.csum_flags = 0;
m->m_pkthdr.PH_per.sixtyfour[0] = 0;