mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MINOR: resolvers: Set port before IP address when processing SRV records
For a server subject to SRV resolution, when the server's address is set, its dynamic cookie, if any, and its server key are computed. Both are based on the ip/port pair. However, this happens before the server's port is set. Thus the port is equal to 0 at this stage. It is a problem if several servers share the same IP but with different ports because they will share the same dynamic cookie and the same server key, disturbing this way the connection persistency and the session stickiness. This patch must be backported as far as 2.2.
This commit is contained in:
parent
68a61b6321
commit
2364b39984
@ -819,6 +819,9 @@ srv_found:
|
|||||||
srv->flags &= ~SRV_F_NO_RESOLUTION;
|
srv->flags &= ~SRV_F_NO_RESOLUTION;
|
||||||
srv->srvrq_check->expire = TICK_ETERNITY;
|
srv->srvrq_check->expire = TICK_ETERNITY;
|
||||||
|
|
||||||
|
srv->svc_port = item->port;
|
||||||
|
srv->flags &= ~SRV_F_MAPPORTS;
|
||||||
|
|
||||||
/* Check if an Additional Record is associated to this SRV record.
|
/* Check if an Additional Record is associated to this SRV record.
|
||||||
* Perform some sanity checks too to ensure the record can be used.
|
* Perform some sanity checks too to ensure the record can be used.
|
||||||
* If all fine, we simply pick up the IP address found and associate
|
* If all fine, we simply pick up the IP address found and associate
|
||||||
@ -873,9 +876,6 @@ srv_found:
|
|||||||
/* Update the server status */
|
/* Update the server status */
|
||||||
srvrq_update_srv_status(srv, (srv->addr.ss_family != AF_INET && srv->addr.ss_family != AF_INET6));
|
srvrq_update_srv_status(srv, (srv->addr.ss_family != AF_INET && srv->addr.ss_family != AF_INET6));
|
||||||
|
|
||||||
srv->svc_port = item->port;
|
|
||||||
srv->flags &= ~SRV_F_MAPPORTS;
|
|
||||||
|
|
||||||
if (!srv->resolv_opts.ignore_weight) {
|
if (!srv->resolv_opts.ignore_weight) {
|
||||||
char weight[9];
|
char weight[9];
|
||||||
int ha_weight;
|
int ha_weight;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user