aboutsummaryrefslogtreecommitdiffstats
path: root/main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-07-16 13:07:22 +0300
committerTimo Teräs <timo.teras@iki.fi>2015-07-16 13:10:00 +0300
commite048450980dfeb8d73df4ba109e14d90d47d2c30 (patch)
tree5fec5e8a9f4cf8d7ea7b006a835cd4943ea6009d /main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch
parent43c0e0d4713cebf43d2ceffe22b0a48c8b204613 (diff)
downloadaports-e048450980dfeb8d73df4ba109e14d90d47d2c30.tar.bz2
aports-e048450980dfeb8d73df4ba109e14d90d47d2c30.tar.xz
main/strongswan: cherry-pick netlink buffer size fixes from upstream
and rename the patches so that we have groups for upstream cherry-picks, patches we want to upstream, and locally carried patches.
Diffstat (limited to 'main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch')
-rw-r--r--main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch b/main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch
new file mode 100644
index 0000000000..0bd694782f
--- /dev/null
+++ b/main/strongswan/0002-kernel-netlink-Use-the-PAGE_SIZE-as-default-for-the-.patch
@@ -0,0 +1,59 @@
+From 7e40d9705de5e94ff64684573c573deb97950b5e Mon Sep 17 00:00:00 2001
+From: Tobias Brunner <tobias@strongswan.org>
+Date: Thu, 16 Jul 2015 11:50:22 +0200
+Subject: [PATCH] kernel-netlink: Use the PAGE_SIZE as default for the netlink
+ receive buffer
+
+The kernel uses NLMSG_GOODSIZE as default buffer size, which defaults to
+the PAGE_SIZE if it is lower than 8192 or to that value otherwise.
+
+In some cases (e.g. for dump messages) the kernel might use up to 16k
+for messages, which might require increasing this value.
+---
+ conf/plugins/kernel-netlink.opt | 2 +-
+ src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.c | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/conf/plugins/kernel-netlink.opt b/conf/plugins/kernel-netlink.opt
+index 4338a5f..6adefd8 100644
+--- a/conf/plugins/kernel-netlink.opt
++++ b/conf/plugins/kernel-netlink.opt
+@@ -1,4 +1,4 @@
+-charon.plugins.kernel-netlink.buflen = 4096
++charon.plugins.kernel-netlink.buflen = <min(PAGE_SIZE, 8192)>
+ Buffer size for received Netlink messages.
+
+ charon.plugins.kernel-netlink.fwmark =
+diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.c
+index 809d0f4..ddb2254 100644
+--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.c
++++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_shared.c
+@@ -571,7 +571,7 @@ netlink_socket_t *netlink_socket_create(int protocol, enum_name_t *names,
+ .protocol = protocol,
+ .names = names,
+ .buflen = lib->settings->get_int(lib->settings,
+- "%s.plugins.kernel-netlink.buflen", 4096, lib->ns),
++ "%s.plugins.kernel-netlink.buflen", 0, lib->ns),
+ .timeout = lib->settings->get_int(lib->settings,
+ "%s.plugins.kernel-netlink.timeout", 0, lib->ns),
+ .retries = lib->settings->get_int(lib->settings,
+@@ -582,6 +582,16 @@ netlink_socket_t *netlink_socket_create(int protocol, enum_name_t *names,
+ .parallel = parallel,
+ );
+
++ if (!this->buflen)
++ {
++ long pagesize = sysconf(_SC_PAGESIZE);
++ if (pagesize == -1)
++ {
++ pagesize = 4096;
++ }
++ /* base this on NLMSG_GOODSIZE */
++ this->buflen = min(pagesize, 8192);
++ }
+ if (this->socket == -1)
+ {
+ DBG1(DBG_KNL, "unable to create netlink socket");
+--
+2.4.5
+