]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: inherit from netns in srv_settings_cpy()
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 14 Jun 2023 07:53:32 +0000 (09:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 Jun 2023 09:27:29 +0000 (11:27 +0200)
When support for 'namespace' keyword was added for the 'default-server'
directive in 22f41a2 ("MINOR: server: Make 'default-server' support
'namespace' keyword."), we forgot to copy the attribute from the parent
to the newly created server.

This resulted in the 'namespace' keyword being parsed without errors when
used from a 'default-server' directive, but in practise the option was
simply ignored.

There's no need to duplicate the netns struct because it is stored in
a shared list, so copying the pointer does the job.

This patch partially fixes GH #2038 and should be backported to all
stable versions.

src/server.c

index 1eb13c42e9820e397161089aa2771f98d18f36f4..fc6df63e7380d8d25ae888cd1204de1dfdf5d93d 100644 (file)
@@ -2404,6 +2404,7 @@ void srv_settings_cpy(struct server *srv, const struct server *src, int srv_tmpl
        if (srv_tmpl)
                srv->srvrq = src->srvrq;
 
+       srv->netns                    = src->netns;
        srv->check.via_socks4         = src->check.via_socks4;
        srv->socks4_addr              = src->socks4_addr;
 }