svn commit: r214461 - stable/8/sys/kern

Michael Tuexen tuexen at FreeBSD.org
Thu Oct 28 16:53:55 UTC 2010


Author: tuexen
Date: Thu Oct 28 16:53:54 2010
New Revision: 214461
URL: http://svn.freebsd.org/changeset/base/214461

Log:
  MFC r211030:
  Fix a bug where MSG_TRUNC was not returned in all necessary cases for
  SOCK_DGRAM socket. MSG_TRUNC was only returned when some mbufs could
  not be copied to the application. If some data was left in the last
  mbuf, it was correctly discarded, but MSG_TRUNC was not set.

Modified:
  stable/8/sys/kern/uipc_socket.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/uipc_socket.c
==============================================================================
--- stable/8/sys/kern/uipc_socket.c	Thu Oct 28 16:51:57 2010	(r214460)
+++ stable/8/sys/kern/uipc_socket.c	Thu Oct 28 16:53:54 2010	(r214461)
@@ -2225,7 +2225,12 @@ soreceive_dgram(struct socket *so, struc
 			m_freem(m);
 			return (error);
 		}
-		m = m_free(m);
+		if (len == m->m_len)
+			m = m_free(m);
+		else {
+			m->m_data += len;
+			m->m_len -= len;
+		}
 	}
 	if (m != NULL)
 		flags |= MSG_TRUNC;


More information about the svn-src-stable mailing list