summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/ip_divert.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index b391fd2..8d2b61b 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -277,21 +277,22 @@ div_output(struct socket *so, struct mbuf *m,
struct divert_tag *dt;
int error = 0;
- KASSERT(m->m_pkthdr.rcvif == NULL, ("rcvif not null"));
+ m->m_pkthdr.rcvif = NULL;
if (control)
m_freem(control); /* XXX */
- mtag = m_tag_get(PACKET_TAG_DIVERT,
- sizeof(struct divert_tag), M_NOWAIT);
- if (mtag == NULL) {
- error = ENOBUFS;
- goto cantsend;
- }
- dt = (struct divert_tag *)(mtag+1);
- dt->info = 0;
- dt->cookie = 0;
- m_tag_prepend(m, mtag);
+ if ((mtag = m_tag_find(m, PACKET_TAG_DIVERT, NULL)) == NULL) {
+ mtag = m_tag_get(PACKET_TAG_DIVERT, sizeof(struct divert_tag),
+ M_NOWAIT | M_ZERO);
+ if (mtag == NULL) {
+ error = ENOBUFS;
+ goto cantsend;
+ }
+ dt = (struct divert_tag *)(mtag+1);
+ m_tag_prepend(m, mtag);
+ } else
+ dt = (struct divert_tag *)(mtag+1);
/* Loopback avoidance and state recovery */
if (sin) {
OpenPOWER on IntegriCloud