summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2014-09-15 07:42:33 +0200
committerJiří Klimeš <jklimes@redhat.com>2014-09-22 11:17:12 +0200
commitefd09845c41e08469d6f6bffa23bd90b6bd06e85 (patch)
treef66df68d58f14fd1987093a4a9dd87875af5d389
parenta36a3a9a522f98fecde80c1ebf1a35d94c630897 (diff)
downloadNetworkManager-efd09845c41e08469d6f6bffa23bd90b6bd06e85.tar.gz
platform: increase NL buffer for systems with lots of interfaces (rh #1141256)
Seems like 128k is not enough for systems with many interfaces. This adds 4k per device, while keeping the 128k minimum. Therefore this change only affects systems with more than 32 interfaces. https://bugzilla.redhat.com/show_bug.cgi?id=1141256
-rw-r--r--src/platform/nm-linux-platform.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 8bec9b2d36..73994cc362 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -3971,6 +3971,7 @@ udev_device_added (NMPlatform *platform,
const char *ifname;
int ifindex;
gboolean was_announceable = FALSE;
+ int nle;
ifname = g_udev_device_get_name (udev_device);
if (!ifname) {
@@ -4001,6 +4002,12 @@ udev_device_added (NMPlatform *platform,
g_hash_table_insert (priv->udev_devices, GINT_TO_POINTER (ifindex),
g_object_ref (udev_device));
+ /* Grow the netlink socket buffer beyond 128k if we have more that 32 interfaces. */
+ nle = nl_socket_set_buffer_size (priv->nlh_event,
+ MAX (131072, 4096 * g_hash_table_size (priv->udev_devices)), 0);
+ if (nle)
+ warning ("udev-add: failed to adjust netlink socket buffer size");
+
/* Announce devices only if they also have been discovered via Netlink. */
if (rtnllink && link_is_announceable (platform, rtnllink))
announce_object (platform, (struct nl_object *) rtnllink, was_announceable ? NM_PLATFORM_SIGNAL_CHANGED : NM_PLATFORM_SIGNAL_ADDED, NM_PLATFORM_REASON_EXTERNAL);