Blob Blame History Raw
From a5eb2f55d79b9023fbda6945da09f9bcecea8560 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Sun, 28 Feb 2021 11:18:16 +0100
Subject: [PATCH 1/1] core: increase limit of open file descriptors for
 NetworkManager.service

Note that POSIX select() can only handle up to 1024 descriptors. That
means, our code (and the libraries that we use) must not use select().

Note that libndp uses select(), which means NetworkManager will crash
when using file descriptors larger than 1023. On the other hand,
depriving NetworkManager of file descriptors will also crash it.
So libndp must be fixed ([1]).

[1] https://listman.redhat.com/archives/libndp-list/2021-February/msg00000.html

https://bugzilla.redhat.com/show_bug.cgi?id=1926599
(cherry picked from commit a708a172a6a289d5399897e7da3a0e38721b1b7e)
(cherry picked from commit 2ca405fa9bd047593cd299691b74af7f44184c71)
---
 data/NetworkManager.service.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in
index 91ebd9a36e65..9cf1c3d28f47 100644
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -19,6 +19,10 @@ CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SE
 ProtectSystem=true
 ProtectHome=read-only
 
+# We require file descriptors for DHCP etc. When activating many interfaces,
+# the default limit of 1024 is easily reached.
+LimitNOFILE=65536
+
 [Install]
 WantedBy=multi-user.target
 Also=NetworkManager-dispatcher.service
-- 
2.29.2