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

Thomas Egerer hakke_007 at gmx.de
Fri Jun 5 02:42:54 PDT 2015


On 06/05/2015 11:30 AM, Thomas Haller wrote:
> 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.
You're right, wasn't the first time, I introduced a typo to a project ;)

> 
> https://github.com/thom311/libnl/commit/a9c789ccd4e24db3b14ffaf3f57ee3e
> 3a57f6fca
> 
> 
Cheers,
Thomas
> 
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20150605/32e9b66e/attachment.sig>


More information about the libnl mailing list