mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-06 19:38:22 +00:00
BUG/MINOR: connection: Use the client's dst family for adressless servers
When the selected server has no address, the destination address of the client is used. However, for now, only the address is set, not the family. Thus depending on how the server is configured and the client's destination address, the server address family may be wrong. For instance, with such server : server srv 0.0.0.0:0 The server address family is AF_INET. The server connection will fail if a client is asking for an IPv6 destination. To fix the bug, we take care to set the rigth family, the family of the client destination address. This patch should fix the issue #202. It must be backported to all stable versions.
This commit is contained in:
parent
e01ca0fbc9
commit
ae3056157c
@ -861,9 +861,11 @@ static int alloc_dst_address(struct sockaddr_storage **ss,
|
||||
if (!conn_get_dst(cli_conn)) {
|
||||
/* do nothing if we can't retrieve the address */
|
||||
} else if (cli_conn->dst->ss_family == AF_INET) {
|
||||
((struct sockaddr_in *)*ss)->sin_family = AF_INET;
|
||||
((struct sockaddr_in *)*ss)->sin_addr =
|
||||
((struct sockaddr_in *)cli_conn->dst)->sin_addr;
|
||||
} else if (cli_conn->dst->ss_family == AF_INET6) {
|
||||
((struct sockaddr_in6 *)*ss)->sin6_family = AF_INET6;
|
||||
((struct sockaddr_in6 *)*ss)->sin6_addr =
|
||||
((struct sockaddr_in6 *)cli_conn->dst)->sin6_addr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user