[PATCH] lib: Return error if an incomplete message was read

Thomas Haller thaller at redhat.com
Fri Jun 5 02:30:50 PDT 2015


On Fr, 2015-06-05 at 08:43 +0200, Thomas Haller wrote:
> On Do, 2015-06-04 at 14:43 +0200, Thomas Egerer wrote:
> > If recvmsg indicates that the message read was truncated libnl 
> > retries
> > to read the complete message after increasing the message buffer. 
> > This
> > only works if the message flags MSG_PEEK | MSG_TRUNC are set. If
> > NL_MSG_PEEK is not enabled on the nl_sock structure, flags are left
> > empty and the rest of the truncated message is discarded, hence a
> > subsequent recvmsg returns the next message (in case of a multipart
> > message, the NLMSG_DONE) is read and returned.
> > This patch aborts message processing if the message was truncated 
> > and
> > teh NL_MSG_PEEK flags was not activated for the nl_sock structure.
> > 
> > Signed-off-by: Thomas Egerer <hakke_007 at gmx.de>
> > ---
> 


> I added NL_CAPABILITY_NL_RECV_FAIL_TRUNK_NO_PEEK to your patch.

should be NL_CAPABILITY_NL_RECV_FAIL_TRUNC_NO_PEEK.


https://github.com/thom311/libnl/commit/a9c789ccd4e24db3b14ffaf3f57ee3e
3a57f6fca


Thomas


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20150605/9ffd658c/attachment-0001.sig>


More information about the libnl mailing list