]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: backend: only match IPv4 addresses with RDP cookies
authorWilly Tarreau <w@1wt.eu>
Fri, 9 May 2014 20:47:50 +0000 (22:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 May 2014 23:26:37 +0000 (01:26 +0200)
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.

src/backend.c

index 24d8142d73021e8f6c680d39b6da8655a87e0f0d..9c3ae0e1a81c99572d979c9131c0a90f21e5df63 100644 (file)
@@ -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;