Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jan 2015 14:32:29 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276752 - head/sys/netinet
Message-ID:  <201501061432.t06EWT45043026@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501061432.t06EWT45043026>