]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Fix haproxy PROXY protocol LOCAL type connection behavior when header...
authorAlex/AT <alex@alex-at.net>
Thu, 23 Apr 2020 12:26:22 +0000 (15:26 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 17 Feb 2021 08:42:00 +0000 (08:42 +0000)
PROXY protocol LOCAL type headers can actually include supplementary
information (addresses, TLVs) which need to be skipped to correctly handle the
header. Fixes Invalid TLV bug with haproxy 2.0.14 service checks.

More info here: https://github.com/haproxy/haproxy/issues/511
And here: https://www.mail-archive.com/haproxy@formilux.org/msg36890.html

src/lib-master/master-service-haproxy.c

index 2affb8b70428fb4528ff48990c502951412ae649..295bf9ac64e9327824b36f7a19317dec629b02b5 100644 (file)
@@ -387,6 +387,7 @@ master_service_haproxy_read(struct master_service_haproxy_conn *hpconn)
                        /* keep local connection address for LOCAL */
                        /*i_debug("haproxy(v2): Local connection (rip=%s)",
                                net_ip2addr(real_remote_ip));*/
+                       i = size; /* we should skip all the remaining data which can be present in PROXY protocol */
                        break;
                case HAPROXY_CMD_PROXY:
                        if ((hdr->fam & 0x0f) != HAPROXY_SOCK_STREAM) {