From owner-svn-src-all@FreeBSD.ORG Tue Jan 6 14:32:29 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60CD4421; Tue, 6 Jan 2015 14:32:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1B6666C8; Tue, 6 Jan 2015 14:32:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t06EWTNl043027; Tue, 6 Jan 2015 14:32:29 GMT (envelope-from rwatson@FreeBSD.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t06EWT45043026; Tue, 6 Jan 2015 14:32:29 GMT (envelope-from rwatson@FreeBSD.org) Message-Id: <201501061432.t06EWT45043026@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rwatson set sender to rwatson@FreeBSD.org using -f From: Robert Watson Date: Tue, 6 Jan 2015 14:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276752 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2015 14:32:29 -0000 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;