Purge layer specific mbuf flags on layer crossings to avoid confusing

upper or lower layers.

Sponsored by:	TCP/IP Optimization Fundraise 2005
This commit is contained in:
Andre Oppermann 2005-11-18 16:23:26 +00:00
parent e86ebebc52
commit 147f74d176
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152583
3 changed files with 20 additions and 1 deletions

View File

@ -736,6 +736,9 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
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:

View File

@ -773,6 +773,12 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
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 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
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

View File

@ -201,6 +201,11 @@ struct mbuf {
M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG|\
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.
*/