mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 14:22:50 +02:00
MINOR: dns: enabled edns0 extension and make accpeted payload size tunable
Edns extensions may be used to negotiate some settings between a DNS client and a server. For now we only use it to announce the maximum response payload size accpeted by HAProxy. This size can be set through a configuration parameter in the resolvers section. If not set, it defaults to 512 bytes.
This commit is contained in:
committed by
Willy Tarreau
parent
572ab8b269
commit
2af08fe3de
@@ -29,7 +29,7 @@ char *dns_str_to_dn_label(const char *string, char *dn, int dn_len);
|
||||
int dns_str_to_dn_label_len(const char *string);
|
||||
void dns_dn_label_to_str(char *dn, char *str, int dn_len);
|
||||
int dns_hostname_validation(const char *string, char **err);
|
||||
int dns_build_query(int query_id, int query_type, char *hostname_dn, int hostname_dn_len, char *buf, int bufsize);
|
||||
int dns_build_query(int query_id, int query_type, unsigned int accepted_payload_size, char *hostname_dn, int hostname_dn_len, char *buf, int bufsize);
|
||||
struct task *dns_process_resolve(struct task *t);
|
||||
int dns_init_resolvers(int close_socket);
|
||||
uint16_t dns_rnd16(void);
|
||||
|
||||
@@ -112,6 +112,20 @@ struct dns_query_item {
|
||||
unsigned short class; /* query class */
|
||||
};
|
||||
|
||||
/* NOTE: big endian structure */
|
||||
struct dns_additional_record {
|
||||
uint8_t name; /* domain name, must be 0 (RFC 6891) */
|
||||
uint16_t type; /* record type DNS_RTYPE_OPT (41) */
|
||||
uint16_t udp_payload_size; /* maximum size accepted for the response */
|
||||
uint32_t extension; /* extended rcode and flags, not used for now */
|
||||
uint16_t data_length; /* data length */
|
||||
/* as of today, we don't support yet edns options, that said I already put a placeholder here
|
||||
* for this purpose. We may need to define a dns_option_record structure which itself should
|
||||
* point to different type of data, based on the extension set (client subnet, tcp keepalive,
|
||||
* etc...)*/
|
||||
// struct list options; /* list of option records */
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* NOTE: big endian structure */
|
||||
struct dns_answer_item {
|
||||
struct list list;
|
||||
@@ -150,6 +164,7 @@ struct dns_resolvers {
|
||||
int line; /* line where the section appears */
|
||||
} conf; /* config information */
|
||||
struct list nameserver_list; /* dns server list */
|
||||
unsigned int accepted_payload_size; /* maximum payload size we accept for responses */
|
||||
int count_nameservers; /* total number of nameservers in a resolvers section */
|
||||
int resolve_retries; /* number of retries before giving up */
|
||||
struct { /* time to: */
|
||||
|
||||
Reference in New Issue
Block a user