mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-23 10:53:04 -04:00
BUG/MINOR: listener: use sockaddr_in6 for IPv6
A copy-paste bug between {tcp,udp}{4,6}_add_listener() resulted in
using a struct sockaddr_in to set the TCP/UDP port while it ought to
be a struct sockaddr_in6. Fortunately, the port has the same offset
(2) in both so it was harmless. A cleaner way to proceed would be
to have a set_port function exported by the address family layer.
This needs to be backported to 2.3.
This commit is contained in:
parent
186f37674c
commit
7da02dd308
2 changed files with 2 additions and 2 deletions
|
|
@ -743,7 +743,7 @@ static void tcpv6_add_listener(struct listener *listener, int port)
|
|||
return;
|
||||
listener_set_state(listener, LI_ASSIGNED);
|
||||
listener->rx.proto = &proto_tcpv6;
|
||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||
((struct sockaddr_in6 *)(&listener->rx.addr))->sin6_port = htons(port);
|
||||
LIST_ADDQ(&proto_tcpv6.receivers, &listener->rx.proto_list);
|
||||
proto_tcpv6.nb_receivers++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static void udp6_add_listener(struct listener *listener, int port)
|
|||
return;
|
||||
listener_set_state(listener, LI_ASSIGNED);
|
||||
listener->rx.proto = &proto_udp6;
|
||||
((struct sockaddr_in *)(&listener->rx.addr))->sin_port = htons(port);
|
||||
((struct sockaddr_in6 *)(&listener->rx.addr))->sin6_port = htons(port);
|
||||
LIST_ADDQ(&proto_udp6.receivers, &listener->rx.proto_list);
|
||||
proto_udp6.nb_receivers++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue