]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: connection: fix ip6 dst_port copy in make_proxy_line_v2
authorWilliam Dauchy <w.dauchy@criteo.com>
Sun, 26 Jan 2020 18:06:39 +0000 (19:06 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 Jan 2020 12:02:58 +0000 (13:02 +0100)
triggered by coverity; src_port is set earlier.

this should fix github issue #467

Fixes: 7fec02153712 ("MEDIUM: proxy_protocol: Convert IPs to v6 when
protocols are mixed")
This should be backported to 1.8.

Signed-off-by: William Dauchy <w.dauchy@criteo.com>
Reviewed-by: Tim Duesterhus <tim@bastelstu.be>
src/connection.c

index ced919f0e0a5b19d9fba27971badb26a0aecd1a7..ff3c34612b92989ca4f2dd4c0b2a57ed68defe45 100644 (file)
@@ -1372,7 +1372,7 @@ int make_proxy_line_v2(char *buf, int buf_len, struct server *srv, struct connec
                        if (dst->ss_family == AF_INET) {
                                v4tov6(&tmp, &((struct sockaddr_in *)dst)->sin_addr);
                                memcpy(hdr->addr.ip6.dst_addr, &tmp, 16);
-                               hdr->addr.ip6.src_port = ((struct sockaddr_in *)src)->sin_port;
+                               hdr->addr.ip6.dst_port = ((struct sockaddr_in *)dst)->sin_port;
                        }
                        else {
                                memcpy(hdr->addr.ip6.dst_addr, &((struct sockaddr_in6 *)dst)->sin6_addr, 16);