[PATCH 2/3] remove (probably) redundant EDNS512 flag - rely on ADB instead
Tony Finch
dot at dotat.at
Mon Jul 28 11:17:05 UTC 2014
---
lib/dns/include/dns/resolver.h | 2 --
lib/dns/resolver.c | 79 ++++--------------------------------------
2 files changed, 6 insertions(+), 75 deletions(-)
diff --git a/lib/dns/include/dns/resolver.h b/lib/dns/include/dns/resolver.h
index e9aabc2..a8f35e4 100644
--- a/lib/dns/include/dns/resolver.h
+++ b/lib/dns/include/dns/resolver.h
@@ -93,8 +93,6 @@ typedef struct dns_fetchevent {
#define DNS_FETCHOPT_NOEDNS0 0x008 /*%< Do not use EDNS. */
#define DNS_FETCHOPT_FORWARDONLY 0x010 /*%< Only use forwarders. */
#define DNS_FETCHOPT_NOVALIDATE 0x020 /*%< Disable validation. */
-#define DNS_FETCHOPT_EDNS512 0x040 /*%< Advertise a 512 byte
- UDP buffer. */
#define DNS_FETCHOPT_WANTNSID 0x080 /*%< Request NSID */
#define DNS_FETCHOPT_PREFETCH 0x100 /*%< Do prefetch */
#define DNS_FETCHOPT_NOCDFLAG 0x200 /*%< Don't set CD flag. */
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index e6e5315..884aeb8 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -145,7 +145,7 @@
* This defines the maximum number of timeouts we will permit before we
* disable EDNS0 on the query.
*/
-#define MAX_EDNS0_TIMEOUTS 3
+#define MAX_EDNS0_TIMEOUTS 6
typedef struct fetchctx fetchctx_t;
@@ -245,7 +245,6 @@ struct fetchctx {
dns_fwdpolicy_t fwdpolicy;
isc_sockaddrlist_t bad;
ISC_LIST(struct tried) edns;
- ISC_LIST(struct tried) edns512;
isc_sockaddrlist_t bad_edns;
dns_validator_t *validator;
ISC_LIST(dns_validator_t) validators;
@@ -1709,39 +1708,6 @@ add_triededns(fetchctx_t *fctx, isc_sockaddr_t *address) {
ISC_LIST_INITANDAPPEND(fctx->edns, tried, link);
}
-static struct tried *
-triededns512(fetchctx_t *fctx, isc_sockaddr_t *address) {
- struct tried *tried;
-
- for (tried = ISC_LIST_HEAD(fctx->edns512);
- tried != NULL;
- tried = ISC_LIST_NEXT(tried, link)) {
- if (isc_sockaddr_equal(&tried->addr, address))
- return (tried);
- }
-
- return (NULL);
-}
-
-static void
-add_triededns512(fetchctx_t *fctx, isc_sockaddr_t *address) {
- struct tried *tried;
-
- tried = triededns512(fctx, address);
- if (tried != NULL) {
- tried->count++;
- return;
- }
-
- tried = isc_mem_get(fctx->mctx, sizeof(*tried));
- if (tried == NULL)
- return;
-
- tried->addr = *address;
- tried->count = 1;
- ISC_LIST_INITANDAPPEND(fctx->edns512, tried, link);
-}
-
#ifdef ISC_PLATFORM_USESIT
static void
compute_cc(resquery_t *query, unsigned char *sit, size_t len) {
@@ -2011,26 +1977,12 @@ resquery_send(resquery_t *query) {
if (fctx->timeout && (query->options & DNS_FETCHOPT_NOEDNS0) == 0) {
- isc_sockaddr_t *sockaddr = &query->addrinfo->sockaddr;
- struct tried *tried;
-
- if (fctx->timeouts > (MAX_EDNS0_TIMEOUTS * 2) &&
+ if (fctx->timeouts > MAX_EDNS0_TIMEOUTS &&
!EDNSOK(query->addrinfo)) {
query->options |= DNS_FETCHOPT_NOEDNS0;
fctx->reason = "disabling EDNS";
- } else if ((tried = triededns512(fctx, sockaddr)) != NULL &&
- tried->count >= 2U && !EDNSOK(query->addrinfo)) {
- query->options |= DNS_FETCHOPT_NOEDNS0;
- fctx->reason = "disabling EDNS";
- } else if ((tried = triededns(fctx, sockaddr)) != NULL) {
- if (tried->count == 1U) {
- hint = dns_adb_getudpsize(fctx->adb,
- query->addrinfo);
- } else if (tried->count >= 2U) {
- query->options |= DNS_FETCHOPT_EDNS512;
- fctx->reason = "reducing the advertised EDNS "
- "UDP packet size to 512 octets";
- }
+ } else {
+ hint = dns_adb_getudpsize(fctx->adb, query->addrinfo);
}
}
fctx->timeout = ISC_FALSE;
@@ -2049,8 +2001,7 @@ resquery_send(resquery_t *query) {
unsigned char sit[64];
#endif
- if ((flags & FCTX_ADDRINFO_EDNSOK) != 0 &&
- (query->options & DNS_FETCHOPT_EDNS512) == 0) {
+ if ((flags & FCTX_ADDRINFO_EDNSOK) != 0) {
udpsize = dns_adb_probesize(fctx->adb,
query->addrinfo);
if (udpsize > res->udpsize)
@@ -2064,12 +2015,6 @@ resquery_send(resquery_t *query) {
udpsize = 512;
/*
- * Was the size forced to 512 in the configuration?
- */
- if (udpsize == 512U)
- query->options |= DNS_FETCHOPT_EDNS512;
-
- /*
* We have talked to this server before.
*/
if (hint != 0U)
@@ -2159,12 +2104,9 @@ resquery_send(resquery_t *query) {
*/
query->udpsize = udpsize;
- if (udpsize > 512U)
+ if (udpsize > 0)
add_triededns(fctx, &query->addrinfo->sockaddr);
- if (udpsize == 512U)
- add_triededns512(fctx, &query->addrinfo->sockaddr);
-
/*
* Clear CD if EDNS is not in use.
*/
@@ -3427,13 +3369,6 @@ fctx_destroy(fetchctx_t *fctx) {
isc_mem_put(fctx->mctx, tried, sizeof(*tried));
}
- for (tried = ISC_LIST_HEAD(fctx->edns512);
- tried != NULL;
- tried = ISC_LIST_HEAD(fctx->edns512)) {
- ISC_LIST_UNLINK(fctx->edns512, tried, link);
- isc_mem_put(fctx->mctx, tried, sizeof(*tried));
- }
-
for (sa = ISC_LIST_HEAD(fctx->bad_edns);
sa != NULL;
sa = next_sa) {
@@ -3831,7 +3766,6 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
fctx->fwdpolicy = dns_fwdpolicy_none;
ISC_LIST_INIT(fctx->bad);
ISC_LIST_INIT(fctx->edns);
- ISC_LIST_INIT(fctx->edns512);
ISC_LIST_INIT(fctx->bad_edns);
ISC_LIST_INIT(fctx->validators);
fctx->validator = NULL;
@@ -7452,7 +7386,6 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
broken_server = DNS_R_TRUNCATEDTCP;
keep_trying = ISC_TRUE;
} else if ((query->options & DNS_FETCHOPT_NOEDNS0) == 0 &&
- (query->options & DNS_FETCHOPT_EDNS512) == 0 &&
!triededns(fctx, &query->addrinfo->sockaddr)) {
resend = ISC_TRUE;
} else {
--
2.1.0.rc0.187.g3b9072a
More information about the bind-workers
mailing list