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);