]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another try to fix reuseport damage
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 17 Sep 2020 22:15:51 +0000 (23:15 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 17 Sep 2020 22:15:51 +0000 (23:15 +0100)
src/libserver/worker_util.c
src/rspamd.c

index 2d40d057c22856d0c4ad65d95bb5cf787df31850..14394726db132c3dc64213cb0d0cfde221230487 100644 (file)
@@ -985,6 +985,8 @@ rspamd_maybe_reuseport_socket (struct rspamd_worker_listen_socket *ls)
        nfd = ls->fd;
 #endif
 
+#if 0
+       /* This needed merely if we have reuseport for tcp, but for now it is disabled */
        /* This means that we have an fd with no listening enabled */
        if (nfd != -1) {
                if (ls->type == RSPAMD_WORKER_SOCKET_TCP) {
@@ -993,6 +995,7 @@ rspamd_maybe_reuseport_socket (struct rspamd_worker_listen_socket *ls)
                        }
                }
        }
+#endif
 
        return true;
 }
@@ -1070,6 +1073,8 @@ rspamd_handle_child_fork (struct rspamd_worker *wrk,
                                                        strerror (errno));
                                }
 
+                               ls->fd = -1;
+
                                cur = g_list_next (cur);
                        }
                }
index 6508b4e8c0550f6f65beae694f2b458c18a1c341..5e87103ebf9682ef40346dbcdfba31afaea1d7dd 100644 (file)
@@ -396,9 +396,7 @@ create_listen_socket (GPtrArray *addrs, guint cnt,
        GList *result = NULL;
        gint fd;
        guint i;
-       static const int listen_opts = RSPAMD_INET_ADDRESS_LISTEN_ASYNC|
-                                                                  RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT|
-                                                                  RSPAMD_INET_ADDRESS_LISTEN_NOLISTEN;
+       static const int listen_opts = RSPAMD_INET_ADDRESS_LISTEN_ASYNC;
        struct rspamd_worker_listen_socket *ls;
 
        g_ptr_array_sort (addrs, rspamd_inet_address_compare_ptr);
@@ -422,7 +420,7 @@ create_listen_socket (GPtrArray *addrs, guint cnt,
                if (listen_type & RSPAMD_WORKER_SOCKET_UDP) {
                        fd = rspamd_inet_address_listen (g_ptr_array_index (addrs, i),
                                        SOCK_DGRAM,
-                                       listen_opts, -1);
+                                       listen_opts | RSPAMD_INET_ADDRESS_LISTEN_REUSEPORT, -1);
                        if (fd != -1) {
                                ls = g_malloc0 (sizeof (*ls));
                                ls->addr = rspamd_inet_address_copy (g_ptr_array_index (addrs, i));