svn commit: r276752 - head/sys/netinet

Robert Watson rwatson at FreeBSD.org
Tue Jan 6 14:32:29 UTC 2015


Author: rwatson
Date: Tue Jan  6 14:32:28 2015
New Revision: 276752
URL: https://svnweb.freebsd.org/changeset/base/276752

Log:
  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

Modified:
  head/sys/netinet/ip_options.c

Modified: head/sys/netinet/ip_options.c
==============================================================================
--- head/sys/netinet/ip_options.c	Tue Jan  6 13:07:13 2015	(r276751)
+++ head/sys/netinet/ip_options.c	Tue Jan  6 14:32:28 2015	(r276752)
@@ -500,7 +500,7 @@ ip_insertoptions(struct mbuf *m, struct 
 	}
 	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;


More information about the svn-src-all mailing list