From: Alex/AT Date: Thu, 23 Apr 2020 12:26:22 +0000 (+0300) Subject: lib-master: Fix haproxy PROXY protocol LOCAL type connection behavior when header... X-Git-Tag: 2.3.15~386 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f753ea9b31ae098a9435a67de69cbb05e78bbb84;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Fix haproxy PROXY protocol LOCAL type connection behavior when header includes address information or TLVs 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 --- diff --git a/src/lib-master/master-service-haproxy.c b/src/lib-master/master-service-haproxy.c index 2affb8b704..295bf9ac64 100644 --- a/src/lib-master/master-service-haproxy.c +++ b/src/lib-master/master-service-haproxy.c @@ -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) {