Use M_WRITABLE() and M_LEADINGSPACE() rather than checking M_EXT and

doing hand-crafted length calculations in the IP options code.

Reviewed by:	bz
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Robert Watson 2015-01-06 14:32:28 +00:00
parent 57c5139c46
commit e1165035a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276752

View File

@ -500,7 +500,7 @@ ip_insertoptions(struct mbuf *m, struct mbuf *opt, int *phlen)
}
if (p->ipopt_dst.s_addr)
ip->ip_dst = p->ipopt_dst;
if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) {
if (!M_WRITABLE(m) || M_LEADINGSPACE(m) < optlen) {
n = m_gethdr(M_NOWAIT, MT_DATA);
if (n == NULL) {
*phlen = 0;