]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-queue.c
Merge pull request #29987 from yuwata/network-bridge-vlan
[thirdparty/systemd.git] / src / network / networkd-queue.c
index cc439a74a83bc5b747ae86407277e44c12dbf17b..0d782dc9a7a98ec78e2eb8d5cb1b3a9af7097077 100644 (file)
@@ -7,6 +7,8 @@
 #include "networkd-queue.h"
 #include "string-table.h"
 
+#define REPLY_CALLBACK_COUNT_THRESHOLD 128
+
 static Request *request_free(Request *req) {
         if (!req)
                 return NULL;
@@ -220,6 +222,13 @@ int manager_process_requests(sd_event_source *s, void *userdata) {
                         if (req->waiting_reply)
                                 continue; /* Waiting for netlink reply. */
 
+                        /* Typically, requests send netlink message asynchronously. If there are many requests
+                         * queued, then this event may make reply callback queue in sd-netlink full. */
+                        if (netlink_get_reply_callback_count(manager->rtnl) >= REPLY_CALLBACK_COUNT_THRESHOLD ||
+                            netlink_get_reply_callback_count(manager->genl) >= REPLY_CALLBACK_COUNT_THRESHOLD ||
+                            fw_ctx_get_reply_callback_count(manager->fw_ctx) >= REPLY_CALLBACK_COUNT_THRESHOLD)
+                                return 0;
+
                         r = req->process(req, link, req->userdata);
                         if (r == 0)
                                 continue;