]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: 'source' interface ignored from 'default-server' directive
authorAurelien DARRAGON <adarragon@haproxy.com>
Tue, 26 Mar 2024 09:42:48 +0000 (10:42 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Tue, 26 Mar 2024 10:09:02 +0000 (11:09 +0100)
Sebastien Gross reported that 'interface' keyword ('source' subargument)
is silently ignored when used from 'default-server' directive despite the
documentation implicitly stating that the keyword should be supported
there.

When support for 'source' keyword was added to 'default-server' directive
in dba97077 ("MINOR: server: Make 'default-server' support 'source'
keyword."), we properly duplicated the conn iface_name from the default-
server but we forgot to copy the conn iface_len which must be set as well
since it is used as setsockopt()'s 'optlen' argument in
tcp_connect_server().

It should be backported to all stable versions.

src/server.c

index 15731b312ae5a721ad1ac0639ede1e121377ed64..555cae82c692f88ba0862e1410e6bd7a84b358d5 100644 (file)
@@ -2474,8 +2474,10 @@ static void srv_conn_src_cpy(struct server *srv, const struct server *src)
        srv->conn_src.bind_hdr_occ = src->conn_src.bind_hdr_occ;
        srv->conn_src.tproxy_addr  = src->conn_src.tproxy_addr;
 #endif
-       if (src->conn_src.iface_name != NULL)
+       if (src->conn_src.iface_name != NULL) {
                srv->conn_src.iface_name = strdup(src->conn_src.iface_name);
+               srv->conn_src.iface_len = src->conn_src.iface_len;
+       }
 }
 
 /*