mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-29 16:44:03 +00:00
netinet*: Add assertions for some places that don't support M_EXTPG mbufs
Found while auditing calls to M_WRITABLE to see if M_EXTPG could be removed from its checks. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D46785
This commit is contained in:
parent
f02d9edfb5
commit
28aafeb83c
@ -1471,6 +1471,7 @@ igmp_input(struct mbuf **mp, int *offp, int proto)
|
||||
m = *mp;
|
||||
ifp = m->m_pkthdr.rcvif;
|
||||
*mp = NULL;
|
||||
M_ASSERTMAPPED(m);
|
||||
|
||||
IGMPSTAT_INC(igps_rcv_total);
|
||||
|
||||
|
@ -1311,6 +1311,8 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m,
|
||||
u_long hash;
|
||||
int hlen;
|
||||
|
||||
M_ASSERTMAPPED(m);
|
||||
|
||||
CTR3(KTR_IPMF, "ip_mforward: delete mfc orig 0x%08x group %lx ifp %p",
|
||||
ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp);
|
||||
|
||||
@ -1562,6 +1564,7 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt, vifi_t xmt_vif)
|
||||
vifi_t vifi;
|
||||
int plen = ntohs(ip->ip_len);
|
||||
|
||||
M_ASSERTMAPPED(m);
|
||||
MRW_LOCK_ASSERT();
|
||||
NET_EPOCH_ASSERT();
|
||||
|
||||
@ -1745,6 +1748,7 @@ phyint_send(struct ip *ip, struct vif *vifp, struct mbuf *m)
|
||||
int hlen = ip->ip_hl << 2;
|
||||
|
||||
MRW_LOCK_ASSERT();
|
||||
M_ASSERTMAPPED(m);
|
||||
|
||||
/*
|
||||
* Make a new reference to the packet; make sure that
|
||||
|
@ -514,6 +514,8 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen)
|
||||
*phlen = 0;
|
||||
return (m); /* XXX should fail */
|
||||
}
|
||||
KASSERT((m->m_flags & M_EXTPG) == 0, ("%s: mbuf %p is unmapped",
|
||||
__func__, m));
|
||||
if (p->ipopt_dst.s_addr)
|
||||
ip->ip_dst = p->ipopt_dst;
|
||||
if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) {
|
||||
|
@ -1073,6 +1073,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
|
||||
GET_TIME(tp);
|
||||
#endif /* UPCALL_TIMING */
|
||||
|
||||
M_ASSERTMAPPED(m);
|
||||
MRT6_DLOG(DEBUG_FORWARD, "src %s, dst %s, ifindex %d",
|
||||
ip6_sprintf(ip6bufs, &ip6->ip6_src),
|
||||
ip6_sprintf(ip6bufd, &ip6->ip6_dst), ifp->if_index);
|
||||
@ -1364,6 +1365,8 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
|
||||
u_int32_t iszone, idzone, oszone, odzone;
|
||||
int error = 0;
|
||||
|
||||
M_ASSERTMAPPED(m);
|
||||
|
||||
/*
|
||||
* Don't forward if it didn't arrive from the parent mif
|
||||
* for its origin.
|
||||
@ -1527,6 +1530,8 @@ phyint_send(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
|
||||
int error __unused = 0;
|
||||
u_long linkmtu;
|
||||
|
||||
M_ASSERTMAPPED(m);
|
||||
|
||||
/*
|
||||
* Make a new reference to the packet; make sure that
|
||||
* the IPv6 header is actually copied, not just referenced,
|
||||
|
Loading…
Reference in New Issue
Block a user