netlink: Clearer reasoning about the netlink response buffer size
Currently we set NLBUFSIZ large enough for 8192 netlink headers (128kiB in total), and reference netlink(7). However netlink(7) says nothing about reponse buffer sizes, and the documents which do reference 8192 *bytes* not 8192 headers. Update NLBUFSIZ to 64kiB with a more detailed rationale. Link: https://bugs.passt.top/show_bug.cgi?id=67 Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
9d4ab98d53
commit
8ec757d003
1 changed files with 8 additions and 1 deletions
|
@ -35,7 +35,14 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "netlink.h"
|
#include "netlink.h"
|
||||||
|
|
||||||
#define NLBUFSIZ (8192 * sizeof(struct nlmsghdr)) /* See netlink(7) */
|
/* Netlink expects a buffer of at least 8kiB or the system page size,
|
||||||
|
* whichever is larger. 32kiB is recommended for more efficient.
|
||||||
|
* Since the largest page size on any remotely common Linux setup is
|
||||||
|
* 64kiB (ppc64), that should cover it.
|
||||||
|
*
|
||||||
|
* https://www.kernel.org/doc/html/next/userspace-api/netlink/intro.html#buffer-sizing
|
||||||
|
*/
|
||||||
|
#define NLBUFSIZ 65536
|
||||||
|
|
||||||
/* Socket in init, in target namespace, sequence (just needs to be monotonic) */
|
/* Socket in init, in target namespace, sequence (just needs to be monotonic) */
|
||||||
int nl_sock = -1;
|
int nl_sock = -1;
|
||||||
|
|
Loading…
Reference in a new issue