summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_mroute.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2014-10-12 15:49:52 +0000
committerrwatson <rwatson@FreeBSD.org>2014-10-12 15:49:52 +0000
commit9532a34956eebfbc46d32db0a73a33a09ff42fb8 (patch)
tree3d1cc176a1a9d02914a169d4a5df66a82f05c1b7 /sys/netinet/ip_mroute.c
parent2791f385b984a34d6a9ec9d1a14314a9d323d57f (diff)
downloadFreeBSD-src-9532a34956eebfbc46d32db0a73a33a09ff42fb8.zip
FreeBSD-src-9532a34956eebfbc46d32db0a73a33a09ff42fb8.tar.gz
When deciding whether to call m_pullup() even though there is adequate
data in an mbuf, use M_WRITABLE() instead of a direct test of M_EXT; the latter both unnecessarily exposes mbuf-allocator internals in the protocol stack and is also insufficient to catch all cases of non-writability. (NB: m_pullup() does not actually guarantee that a writable mbuf is returned, so further refinement of all of these code paths continues to be required.) Reviewed by: bz MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D900
Diffstat (limited to 'sys/netinet/ip_mroute.c')
-rw-r--r--sys/netinet/ip_mroute.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index 05605a8..7239946 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -121,7 +121,6 @@ __FBSDID("$FreeBSD$");
#endif
#define VIFI_INVALID ((vifi_t) -1)
-#define M_HASCL(m) ((m)->m_flags & M_EXT)
static VNET_DEFINE(uint32_t, last_tv_sec); /* last time we processed this */
#define V_last_tv_sec VNET(last_tv_sec)
@@ -1304,7 +1303,7 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
}
mb0 = m_copypacket(m, M_NOWAIT);
- if (mb0 && (M_HASCL(mb0) || mb0->m_len < hlen))
+ if (mb0 && (!M_WRITABLE(mb0) || mb0->m_len < hlen))
mb0 = m_pullup(mb0, hlen);
if (mb0 == NULL) {
free(rte, M_MRTABLE);
@@ -1544,7 +1543,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif)
int hlen = ip->ip_hl << 2;
struct mbuf *mm = m_copy(m, 0, hlen);
- if (mm && (M_HASCL(mm) || mm->m_len < hlen))
+ if (mm && (!M_WRITABLE(mm) || mm->m_len < hlen))
mm = m_pullup(mm, hlen);
if (mm == NULL)
return ENOBUFS;
@@ -1665,7 +1664,7 @@ phyint_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
* so that ip_output() only scribbles on the copy.
*/
mb_copy = m_copypacket(m, M_NOWAIT);
- if (mb_copy && (M_HASCL(mb_copy) || mb_copy->m_len < hlen))
+ if (mb_copy && (!M_WRITABLE(mb_copy) || mb_copy->m_len < hlen))
mb_copy = m_pullup(mb_copy, hlen);
if (mb_copy == NULL)
return;
OpenPOWER on IntegriCloud