]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: servers: Correctly use LIST_ELEM().
authorOlivier Houchard <ohouchard@haproxy.com>
Thu, 27 Dec 2018 14:35:22 +0000 (15:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 28 Dec 2018 15:33:06 +0000 (16:33 +0100)
To access the first element of the list, correctly use LIST_ELEM(), or we
end up getting the head of the list, instead of getting the first connection.

This should be backported to 1.9.

src/backend.c

index e82775058bad4c5dd1b36e1b29f13e83c9f16f58..0c17ef893c52482021eed4fe5ce0298e7662df7d 100644 (file)
@@ -1151,7 +1151,7 @@ int connect_server(struct stream *s)
                        srv_conn = NULL;
                        for (i = 0; i < MAX_SRV_LIST; i++) {
                                if (!LIST_ISEMPTY(&s->sess->srv_list[i].list)) {
-                                       srv_conn = LIST_ELEM(&s->sess->srv_list[i].list,
+                                       srv_conn = LIST_ELEM(s->sess->srv_list[i].list.n,
                                            struct connection *, session_list);
                                        break;
                                }