summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_ethersubr.c3
-rw-r--r--sys/netinet/ip_output.c13
-rw-r--r--sys/sys/mbuf.h5
3 files changed, 20 insertions, 1 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 7cfba9a..f7f1e84 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -736,6 +736,9 @@ post_stats:
m->m_flags &= ~M_HASFCS;
}
+ /* Reset layer specific mbuf flags to avoid confusing upper layers. */
+ m->m_flags &= ~(M_PROTOFLAGS);
+
switch (ether_type) {
#ifdef INET
case ETHERTYPE_IP:
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 0e210ac..edd49e1 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -773,6 +773,12 @@ passout:
if (mbuf_frag_size && m->m_pkthdr.len > mbuf_frag_size)
m = m_fragment(m, M_DONTWAIT, mbuf_frag_size);
#endif
+ /*
+ * Reset layer specific mbuf flags
+ * to avoid confusing lower layers.
+ */
+ m->m_flags &= ~(M_PROTOFLAGS);
+
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst, ro->ro_rt);
goto done;
@@ -815,7 +821,12 @@ passout:
ia->ia_ifa.if_opackets++;
ia->ia_ifa.if_obytes += m->m_pkthdr.len;
}
-
+ /*
+ * Reset layer specific mbuf flags
+ * to avoid confusing upper layers.
+ */
+ m->m_flags &= ~(M_PROTOFLAGS);
+
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst, ro->ro_rt);
} else
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 08dfb60..e807f54 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -202,6 +202,11 @@ struct mbuf {
M_VLANTAG)
/*
+ * Flags to purge when crossing layers.
+ */
+#define M_PROTOFLAGS (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5)
+
+/*
* Flags indicating hw checksum support and sw checksum requirements.
*/
#define CSUM_IP 0x0001 /* will csum IP */
OpenPOWER on IntegriCloud