A resolvers section accept the following parameters:
accepted_payload_size <nb>
- Defines the maximum payload size accepted by HAProxy and announced to all the
- name servers configured in this resolvers section.
+ Defines the maximum UDP payload size accepted by HAProxy and announced to all
+ the name servers configured in this resolvers section.
<nb> is in bytes. If not set, HAProxy announces 512. (minimal value defined
by RFC 6891)
Note: the maximum allowed value is 65535. Recommended value for UDP is
4096 and it is not recommended to exceed 8192 except if you are sure
that your system and network can handle this (over 65507 makes no sense
- since is the maximum UDP payload size). If you are using only TCP
- nameservers to handle huge DNS responses, you should put this value
- to the max: 65535.
+ since it is the maximum UDP payload size). DNS responses received over a
+ stream transport are accepted up to the DNS protocol maximum of 65535
+ bytes regardless of this setting.
nameserver <name> <address>[:port] [param*]
Used to configure a nameserver. <name> of the nameserver should ne unique.
*/
struct resolvers {
__decl_thread(HA_SPINLOCK_T lock);
- unsigned int accepted_payload_size; /* maximum payload size we accept for responses */
+ unsigned int accepted_payload_size; /* maximum UDP payload size we announce and accept */
int nb_nameservers; /* total number of nameservers in a resolvers section */
int resolve_retries; /* number of retries before giving up */
struct { /* time to: */
unsigned char *bufend;
int buflen, dns_resp;
int max_answer_records;
+ unsigned int max_payload_size;
unsigned short query_id;
struct eb32_node *eb;
struct resolv_requester *req;
int keep_answer_items;
resolvers = ns->parent;
+ max_payload_size = dns_server_type_is_stream(type) ?
+ DNS_MAX_MSG_SIZE : resolvers->accepted_payload_size;
enter_resolver_code();
HA_SPIN_LOCK(DNS_LOCK, &resolvers->lock);
break;
/* message too big */
- if (buflen > resolvers->accepted_payload_size) {
+ if (buflen > max_payload_size) {
ns->counters->app.resolver.too_big++;
continue;
}
/* number of responses received */
res->nb_responses++;
- max_answer_records = (resolvers->accepted_payload_size - DNS_HEADER_SIZE) / DNS_MIN_RECORD_SIZE;
+ max_answer_records = (max_payload_size - DNS_HEADER_SIZE) / DNS_MIN_RECORD_SIZE;
dns_resp = resolv_validate_dns_response(buf, bufend, res, max_answer_records);
switch (dns_resp) {