]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-ana: Only consider dst address to process originalto option
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Feb 2021 11:45:56 +0000 (12:45 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 26 Feb 2021 12:32:14 +0000 (13:32 +0100)
When an except parameter is used for originalto option, only the destination
address must be evaluated. Especially, the address family of the destination
must be tested and not the source one.

This patch must be backported to all stable versions. However be careful,
depending the versions the code may be slightly different.

src/http_ana.c

index 84324eb20092f9f57aecc95f36ecbd3c0157b9a3..d18b4ccb0c184ca29d1ba7ffca4b19c004836d95 100644 (file)
@@ -719,7 +719,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
        if ((sess->fe->options | s->be->options) & PR_O_ORGTO) {
 
                /* FIXME: don't know if IPv6 can handle that case too. */
-               if (cli_conn && conn_get_src(cli_conn) && cli_conn->src->ss_family == AF_INET && conn_get_dst(cli_conn)) {
+               if (cli_conn && conn_get_dst(cli_conn) && cli_conn->dst->ss_family == AF_INET) {
                        /* Add an X-Original-To header unless the destination IP is
                         * in the 'except' network range.
                         */