MINOR: dns: fix wrong score computation in dns_get_ip_from_response

dns_get_ip_from_response() is used to compare the caller current IP to
the IP available in the records returned by the DNS server.
A scoring system is in place to get the best IP address available.
That said, in the current implementation, there are a couple of issues:
1. a comment does not match what the code does
2. the code does not match what the commet says (score value is not
   incremented with '2')

This patch fixes both issues.

Backport status: 1.8
This commit is contained in:
Baptiste Assmann 2018-06-22 13:03:50 +02:00 committed by Willy Tarreau
parent 741e00a820
commit 84221b4e90
1 changed files with 5 additions and 2 deletions

View File

@ -1024,10 +1024,13 @@ int dns_get_ip_from_response(struct dns_response_packet *dns_p,
}
/* Check if the IP found in the record is already affected to a
* member of a group. If yes, the score should be incremented
* member of a group. If not, the score should be incremented
* by 2. */
if (owner && snr_check_ip_callback(owner, ip, &ip_type))
if (owner && snr_check_ip_callback(owner, ip, &ip_type)) {
continue;
} else {
score += 2;
}
/* Check for current ip matching. */
if (ip_type == currentip_sin_family &&