Subject: Possible bug in netlink_recvmsg()

From: David Howells <[email-masked]>
Date: Fri, 13 Apr 2007 19:08:31 +0100

As I understand it, according to the recvmsg() manual page, if the packet
being returned is larger than the buffer provided, and the protocol does not
support piecemeal reception of data, then:

 (1) the buffer should be filled,

 (2) MSG_TRUNC should be set in msg_flags, and

 (3) the length of the full packet, including the discarded bit should be
     returned.

AF_NETLINK sockets, however, do not do (3).  See this bit in netlink_recvmsg():

	copied = skb->len;
	if (len < copied) {
		msg->msg_flags |= MSG_TRUNC;
		copied = len;
	}

Or is this only true if the caller of recvmsg() passes MSG_TRUNC in?

David