mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
plugins: fix #173, increase size of netlink socket receive buffer
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -335,6 +335,8 @@ static plugin_t plugin = {
|
||||
PLUGIN_INIT(plugin_init)
|
||||
{
|
||||
struct sockaddr_nl sa;
|
||||
socklen_t sz;
|
||||
int rcvbuf;
|
||||
int sd;
|
||||
|
||||
sd = socket(AF_NETLINK, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, NETLINK_ROUTE);
|
||||
@@ -343,6 +345,14 @@ PLUGIN_INIT(plugin_init)
|
||||
return;
|
||||
}
|
||||
|
||||
rcvbuf = 320 << 10; /* default: 212992 bytes, now 425984 bytes */
|
||||
if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)))
|
||||
_pe("failed adjusting netlink socket recive buffer size");
|
||||
|
||||
sz = sizeof(rcvbuf);
|
||||
if (!getsockopt(sd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, &sz))
|
||||
_d("New size of netlink receive buffer: %d bytes", rcvbuf);
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.nl_family = AF_NETLINK;
|
||||
sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_LINK; // | RTMGRP_NOTIFY | RTMGRP_IPV4_IFADDR;
|
||||
|
||||
Reference in New Issue
Block a user