From: Willy Tarreau Date: Fri, 9 May 2014 20:47:50 +0000 (+0200) Subject: BUG/MINOR: backend: only match IPv4 addresses with RDP cookies X-Git-Tag: v1.5-dev25~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28e9d06201a513c7a54d0feb7625849f776c6128;p=thirdparty%2Fhaproxy.git BUG/MINOR: backend: only match IPv4 addresses with RDP cookies The RDP cookie extractor compares the 32-bit address from the request to the address of each server in the farm without first checking that the server's address is IPv4. This is a leftover from the IPv4 to IPv6 conversion. It's harmless as it's unlikely that IPv4 and IPv6 servers will be mixed in an RDP farm, but better fix it. This patch does not need to be backported. --- diff --git a/src/backend.c b/src/backend.c index 24d8142d73..9c3ae0e1a8 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1239,7 +1239,8 @@ int tcp_persist_rdp_cookie(struct session *s, struct channel *req, int an_bit) s->target = NULL; while (srv) { - if (memcmp(&addr, &(srv->addr), sizeof(addr)) == 0) { + if (srv->addr.ss_family == AF_INET && + memcmp(&addr, &(srv->addr), sizeof(addr)) == 0) { if ((srv->state & SRV_RUNNING) || (px->options & PR_O_PERSIST)) { /* we found the server and it is usable */ s->flags |= SN_DIRECT | SN_ASSIGNED;