BUG/MINOR: connection: fix ip6 dst_port copy in make_proxy_line_v2
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>
(cherry picked from commit bd8bf67102d061f777c3e41db206e86bbae60be7)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 1c3fac0b7e5e6462ca2ea989e3ec41a8fa909fff)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/src/connection.c b/src/connection.c
index 4d6d4d5..6dc50a1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1265,7 +1265,7 @@
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);