]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
http: fix SO_REUSEPORT for HTTP sockets obs-knot-resolver-bs4hbr/deployments/286
authorPetr Špaček <petr.spacek@nic.cz>
Tue, 8 Oct 2019 16:57:07 +0000 (18:57 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Tue, 8 Oct 2019 16:59:49 +0000 (18:59 +0200)
lua-cqueues.socket.fdopen() resets the reuseport flag, so binding Nth
instance without systemd socket activation failed

modules/http/http.lua.in

index 0d07c4e6658e687429ac8b352aca3a1b863b9b7a..4e6967cd853e11a416b215a025970df8e7a86e91 100644 (file)
@@ -278,7 +278,7 @@ local function add_socket(fd, kind, addr_str)
        assert(M.servers[fd] == nil, 'socket is already served by an HTTP instance')
        local conf = mergeconf(M.configs._builtin._all, M.configs._builtin[kind],
                                                M.configs._all, M.configs[kind])
-       conf.socket = cqueues.socket.fdopen(fd)
+       conf.socket = cqueues.socket.fdopen({ fd = fd, reuseport = true, reuseaddr = true })
        if conf.tls ~= false then -- Create a TLS context, either from files or new.
                if conf.ephemeral then
                        if not M.ephem_state then