From owner-svn-src-all@FreeBSD.ORG Mon Jun 22 21:46:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EF5C106566C; Mon, 22 Jun 2009 21:46:41 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F15DA8FC23; Mon, 22 Jun 2009 21:46:40 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLke4N053724; Mon, 22 Jun 2009 21:46:40 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLkep4053722; Mon, 22 Jun 2009 21:46:40 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <200906222146.n5MLkep4053722@svn.freebsd.org> From: Andre Oppermann Date: Mon, 22 Jun 2009 21:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194662 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 22 Jun 2009 21:46:41 -0000 Author: andre Date: Mon Jun 22 21:46:40 2009 New Revision: 194662 URL: http://svn.freebsd.org/changeset/base/194662 Log: In sbappendstream_locked() demote all incoming packet mbufs (and chains) to pure data mbufs using m_demote(). This removes the packet header and all m_tag information as they are not meaningful anymore on a stream socket where mbufs are linked through m->m_next. Strictly speaking a packet header can be only ever valid on the first mbuf in an m_next chain. sbcompress() was doing this already when the mbuf chain layout lent itself to it (e.g. header splitting or merge-append), just not consistently. This frees resources at socket buffer append time instead of at sbdrop_internal() time after data has been read from the socket. For MAC the per packet information has done its duty and during socket buffer appending the policy of the socket itself takes over. With the append the packet boundaries disappear naturally and with it any context that was based on it. None of the residual information from mbuf headers in the socket buffer on stream sockets was looked at. Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Mon Jun 22 21:42:57 2009 (r194661) +++ head/sys/kern/uipc_sockbuf.c Mon Jun 22 21:46:40 2009 (r194662) @@ -528,6 +528,9 @@ sbappendstream_locked(struct sockbuf *sb SBLASTMBUFCHK(sb); + /* Remove all packet headers and mbuf tags to get a pure data chain. */ + m_demote(m, 1); + sbcompress(sb, m, sb->sb_mbtail); sb->sb_lastrecord = sb->sb_mb;