]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stick-table: insert srv in used_name tree even with fixed id
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 14 Jun 2021 15:04:25 +0000 (17:04 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 15 Jun 2021 08:50:02 +0000 (10:50 +0200)
If the server id is fixed in the configuration, it is immediately
inserted in the 'used_server_id' backend tree via srv_parse_id. On
check_config_validity, the dynamic id generation is thus skipped for
fixed-id servers. However, it must nevertheless be inserted in the
'used_server_name' backend tree.

This bug seems to be not noticeable for the user. Indeed, before the
fix, the search in sticking_rule_find_target always returned NULL for
the name, then the fallback search with server id succeeded, so the
persistence is properly applied. However with the fix the fallback
search is not executed anymore, which saves from the locking of
STK_SESS.

This should be backported up to 2.0.

src/cfgparse.c

index 906ab076f8c120d5186b824f197e2aef0a37ea35..3011f655ead9297c96493ffe5c8cc5c9b87edc6a 100644 (file)
@@ -3496,9 +3496,10 @@ out_uri_auth_compat:
                                next_id = get_next_id(&curproxy->conf.used_server_id, next_id);
                                newsrv->conf.id.key = newsrv->puid = next_id;
                                eb32_insert(&curproxy->conf.used_server_id, &newsrv->conf.id);
-                               newsrv->conf.name.key = newsrv->id;
-                               ebis_insert(&curproxy->conf.used_server_name, &newsrv->conf.name);
                        }
+                       newsrv->conf.name.key = newsrv->id;
+                       ebis_insert(&curproxy->conf.used_server_name, &newsrv->conf.name);
+
                        next_id++;
                        newsrv = newsrv->next;
                }