charon.plugins.kernel-netlink.buflen = <min(PAGE_SIZE, 8192)>
Buffer size for received Netlink messages.
-charon.plugins.kernel-netlink.force_receive_buffer_size = no
- Force maximum Netlink receive buffer on Netlink socket.
-
- If the maximum Netlink socket receive buffer in bytes set by
- _receive_buffer_size_ exceeds the system-wide maximum from
- /proc/sys/net/core/rmem_max, this option can be used to override the limit.
- Enabling this option requires special privileges (CAP_NET_ADMIN).
-
charon.plugins.kernel-netlink.fwmark =
Firewall mark to set on the routing rule that directs traffic to our routing
table.
currently only useful if the kernel based route lookup is used (i.e. if
route installation is disabled or an inverted fwmark match is configured).
-charon.plugins.kernel-netlink.receive_buffer_size = 0
+charon.plugins.kernel-netlink.receive_buffer_size = 8388608
Maximum Netlink socket receive buffer in bytes.
Maximum Netlink socket receive buffer in bytes. This value controls how many
- bytes of Netlink messages can be received on a Netlink socket. The default
- value is set by /proc/sys/net/core/rmem_default. The specified value cannot
- exceed the system-wide maximum from /proc/sys/net/core/rmem_max, unless
- _force_receive_buffer_size_ is enabled.
+ bytes of Netlink messages can be queued to a Netlink socket. If set to 0,
+ the default from /proc/sys/net/core/rmem_default will apply. Note that the
+ kernel doubles the configured value to account for overhead. To exceed the
+ system-wide maximum from /proc/sys/net/core/rmem_max, special privileges
+ (CAP_NET_ADMIN) are necessary, otherwise, the kernel silently caps the
+ value.
charon.plugins.kernel-netlink.roam_events = yes
Whether to trigger roam events when interfaces, addresses or routes change.
#define SOL_NETLINK 270
#endif
+/**
+ * Default receive buffer size
+ */
+#ifndef NETLINK_RCVBUF_DEFAULT
+#define NETLINK_RCVBUF_DEFAULT (8 * 1024 * 1024)
+#endif
+
typedef struct private_netlink_socket_t private_netlink_socket_t;
typedef struct private_netlink_event_socket_t private_netlink_event_socket_t;
struct sockaddr_nl addr = {
.nl_family = AF_NETLINK,
};
- bool force_buf = FALSE;
int on = 1, rcvbuf_size = 0;
INIT(this,
rcvbuf_size = lib->settings->get_int(lib->settings,
"%s.plugins.kernel-netlink.receive_buffer_size",
- rcvbuf_size, lib->ns);
+ NETLINK_RCVBUF_DEFAULT, lib->ns);
if (rcvbuf_size)
{
- int optname;
-
- force_buf = lib->settings->get_bool(lib->settings,
- "%s.plugins.kernel-netlink.force_receive_buffer_size",
- force_buf, lib->ns);
- optname = force_buf ? SO_RCVBUFFORCE : SO_RCVBUF;
-
- if (setsockopt(this->socket, SOL_SOCKET, optname, &rcvbuf_size,
+ if (setsockopt(this->socket, SOL_SOCKET, SO_RCVBUFFORCE, &rcvbuf_size,
+ sizeof(rcvbuf_size)) == -1 &&
+ setsockopt(this->socket, SOL_SOCKET, SO_RCVBUF, &rcvbuf_size,
sizeof(rcvbuf_size)) == -1)
{
- DBG1(DBG_KNL, "failed to %supdate receive buffer size to %d: %s",
- force_buf ? "forcibly " : "", rcvbuf_size, strerror(errno));
+ DBG1(DBG_KNL, "failed to set receive buffer size to %d: %s",
+ rcvbuf_size, strerror(errno));
}
}
if (this->parallel)