Skip to content

Conversation

@refi64
Copy link

@refi64 refi64 commented Jan 2, 2023

Because the buffer size is a fixed 4kb, if a netlink message is truncated, only some parts of it would end up in the buffer, leading to the message being dropped. Instead, peek at the message size ahead via MSG_PEEK|MSG_TRUNC and allocate a buffer to fit it dynamically. (AFAIK netlink messages can be >4kb anyway, so this is a bit more generally useful.)

Because the buffer size is a fixed 4kb, if a netlink message is
truncated, only some parts of it would end up in the buffer, leading to
the message being dropped. Instead, peek at the message size ahead via
MSG_PEEK|MSG_TRUNC and allocate a buffer to fit it dynamically. (AFAIK
netlink messages can be >4kb anyway, so this is a bit more generally
useful.)
@troglobit
Copy link

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants