mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 07:54:33 +00:00
BUG/MINOR: resolvers: throw log message if trash not large enough for query
Before this patch the sent error counter was increased for each targeted nameserver as soon as we were unable to build the query message into the trash buffer. But this counter is here to count sent errors at dns.c transport layer and this error is not related to a nameserver. This patch stops to increase those counters and sent a log message to signal the trash buffer size is not large enough to build the query. Note: This case should not happen except if trash size buffer was customized to a very low value. The function was also re-worked to return -1 in this error case as it was specified in comment. This function is currently called at multiple point in resolver.c but return code is still not yet handled. So to advert the user of the malfunction the log message was added. This patch should be backported on all versions including the layer split between dns.c and resolver.c (v >= 2.4)
This commit is contained in:
parent
c37caab21c
commit
0161d32df2
@ -350,7 +350,7 @@ static int resolv_build_query(int query_id, int query_type, unsigned int accepte
|
||||
}
|
||||
|
||||
/* Sends a DNS query to resolvers associated to a resolution. It returns 0 on
|
||||
* success, -1 otherwise.
|
||||
* success or -1 if trash buffer is not large enough to build a valid query.
|
||||
*/
|
||||
static int resolv_send_query(struct resolv_resolution *resolution)
|
||||
{
|
||||
@ -367,13 +367,14 @@ static int resolv_send_query(struct resolv_resolution *resolution)
|
||||
resolvers->accepted_payload_size,
|
||||
resolution->hostname_dn, resolution->hostname_dn_len,
|
||||
trash.area, trash.size);
|
||||
if (len < 0) {
|
||||
send_log(NULL, LOG_NOTICE,
|
||||
"can not build the query message for %s, in resolvers %s.\n",
|
||||
resolution->hostname_dn, resolvers->id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
list_for_each_entry(ns, &resolvers->nameservers, list) {
|
||||
if (len < 0) {
|
||||
ns->counters->snd_error++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dns_send_nameserver(ns, trash.area, len) >= 0)
|
||||
resolution->nb_queries++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user