Adam Tkac 31f7ce
diff -up bind-9.5.0a7/lib/dns/view.c.edns bind-9.5.0a7/lib/dns/view.c
Adam Tkac 31f7ce
--- bind-9.5.0a7/lib/dns/view.c.edns	2007-06-19 01:47:42.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/lib/dns/view.c	2007-11-15 12:32:12.000000000 +0100
Adam Tkac 007ac2
@@ -179,6 +179,7 @@ dns_view_create(isc_mem_t *mctx, dns_rda
Adam Tkac 007ac2
 	view->flush = ISC_FALSE;
Adam Tkac 007ac2
 	view->dlv = NULL;
Adam Tkac 007ac2
 	view->maxudp = 0;
Adam Tkac 007ac2
+	view->edns = ISC_TRUE;
Adam Tkac 007ac2
 	dns_fixedname_init(&view->dlv_fixed);
Adam Tkac 007ac2
 
Adam Tkac 007ac2
 	result = dns_order_create(view->mctx, &view->order);
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/lib/dns/resolver.c.edns bind-9.5.0a7/lib/dns/resolver.c
Adam Tkac 31f7ce
--- bind-9.5.0a7/lib/dns/resolver.c.edns	2007-10-19 19:15:53.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/lib/dns/resolver.c	2007-11-15 12:32:44.000000000 +0100
Adam Tkac 31f7ce
@@ -1509,10 +1509,12 @@ resquery_send(resquery_t *query) {
Adam Tkac 31f7ce
          * The ADB does not know about servers with "edns no".  Check this,
Adam Tkac 31f7ce
          * and then inform the ADB for future use.
Adam Tkac 31f7ce
          */
Adam Tkac 31f7ce
-        if ((query->addrinfo->flags & DNS_FETCHOPT_NOEDNS0) == 0 &&
Adam Tkac 31f7ce
-            peer != NULL &&
Adam Tkac 31f7ce
-            dns_peer_getsupportedns(peer, &useedns) == ISC_R_SUCCESS &&
Adam Tkac 31f7ce
-            !useedns)
Adam Tkac 31f7ce
+        if (((query->addrinfo->flags & DNS_FETCHOPT_NOEDNS0) == 0 ||
Adam Tkac 31f7ce
+              (query->options & DNS_FETCHOPT_NOEDNS0) == 0) &&
Adam Tkac 31f7ce
+            (!(res->view->edns) ||
Adam Tkac 31f7ce
+             (peer != NULL &&
Adam Tkac 31f7ce
+              dns_peer_getsupportedns(peer, &useedns) == ISC_R_SUCCESS &&
Adam Tkac 31f7ce
+              !useedns)))
Adam Tkac 31f7ce
         {
Adam Tkac 31f7ce
                 query->options |= DNS_FETCHOPT_NOEDNS0;
Adam Tkac 31f7ce
                 dns_adb_changeflags(fctx->adb,
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/lib/dns/include/dns/view.h.edns bind-9.5.0a7/lib/dns/include/dns/view.h
Adam Tkac 31f7ce
--- bind-9.5.0a7/lib/dns/include/dns/view.h.edns	2007-06-19 01:47:42.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/lib/dns/include/dns/view.h	2007-11-15 12:32:12.000000000 +0100
Adam Tkac 007ac2
@@ -137,6 +137,7 @@ struct dns_view {
Adam Tkac 007ac2
 	dns_name_t *			dlv;
Adam Tkac 007ac2
 	dns_fixedname_t			dlv_fixed;
Adam Tkac 007ac2
 	isc_uint16_t			maxudp;
Adam Tkac 007ac2
+	isc_boolean_t			edns;
Adam Tkac 007ac2
 
Adam Tkac 007ac2
 	/*
Adam Tkac 007ac2
 	 * Configurable data for server use only,
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/lib/isccfg/namedconf.c.edns bind-9.5.0a7/lib/isccfg/namedconf.c
Adam Tkac 31f7ce
--- bind-9.5.0a7/lib/isccfg/namedconf.c.edns	2007-09-26 05:22:45.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/lib/isccfg/namedconf.c	2007-11-15 12:32:12.000000000 +0100
Adam Tkac 007ac2
@@ -618,6 +618,7 @@ options_clauses[] = {
Adam Tkac 007ac2
 	{ "deallocate-on-exit", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
Adam Tkac 007ac2
 	{ "directory", &cfg_type_qstring, CFG_CLAUSEFLAG_CALLBACK },
Adam Tkac 007ac2
 	{ "dump-file", &cfg_type_qstring, 0 },
Adam Tkac 007ac2
+	{ "edns", &cfg_type_boolean, 0 },
Adam Tkac 007ac2
 	{ "fake-iquery", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
Adam Tkac 007ac2
 	{ "files", &cfg_type_size, 0 },
Adam Tkac 007ac2
 	{ "has-old-clients", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE },
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/doc/misc/options.edns bind-9.5.0a7/doc/misc/options
Adam Tkac 31f7ce
--- bind-9.5.0a7/doc/misc/options.edns	2007-10-22 00:15:34.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/doc/misc/options	2007-11-15 12:34:04.000000000 +0100
Adam Tkac 31f7ce
@@ -97,6 +97,7 @@ options {
Adam Tkac 31f7ce
             <integer>] | <ipv4_address> [port <integer>] | <ipv6_address>
Adam Tkac 31f7ce
             [port <integer>] ); ... };
Adam Tkac 007ac2
         dump-file <quoted_string>;
Adam Tkac 007ac2
+	edns <boolean>;
Adam Tkac 31f7ce
         edns-udp-size <integer>;
Adam Tkac 31f7ce
         empty-contact <string>;
Adam Tkac 31f7ce
         empty-server <string>;
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/bin/named/config.c.edns bind-9.5.0a7/bin/named/config.c
Adam Tkac 31f7ce
--- bind-9.5.0a7/bin/named/config.c.edns	2007-10-19 19:15:53.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/bin/named/config.c	2007-11-15 12:34:33.000000000 +0100
Adam Tkac 007ac2
@@ -137,6 +137,7 @@ options {\n\
Adam Tkac 007ac2
 	acache-enable no;\n\
Adam Tkac 007ac2
 	acache-cleaning-interval 60;\n\
Adam Tkac 31f7ce
 	max-acache-size 16M;\n\
Adam Tkac 007ac2
+	edns yes;\n\
Adam Tkac 007ac2
 	dnssec-enable yes;\n\
Adam Tkac 007ac2
 	dnssec-validation no; /* Make yes for 9.5. */ \n\
Adam Tkac 007ac2
 	dnssec-accept-expired no;\n\
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/bin/named/server.c.edns bind-9.5.0a7/bin/named/server.c
Adam Tkac 31f7ce
--- bind-9.5.0a7/bin/named/server.c.edns	2007-10-18 03:37:49.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/bin/named/server.c	2007-11-15 12:32:12.000000000 +0100
Adam Tkac 31f7ce
@@ -1669,7 +1669,12 @@ configure_view(dns_view_t *view, const c
Adam Tkac 007ac2
 	dns_resolver_setclientsperquery(view->resolver,
Adam Tkac 007ac2
 					cfg_obj_asuint32(obj),
Adam Tkac 007ac2
 					max_clients_per_query);
Adam Tkac 007ac2
-			
Adam Tkac 007ac2
+
Adam Tkac 007ac2
+	obj = NULL;
Adam Tkac 007ac2
+	result = ns_config_get(maps, "edns", &obj);
Adam Tkac 007ac2
+	INSIST(result == ISC_R_SUCCESS);
Adam Tkac 007ac2
+	view->edns = cfg_obj_asboolean(obj);
Adam Tkac 007ac2
+
Adam Tkac 007ac2
 	obj = NULL;
Adam Tkac 007ac2
 	result = ns_config_get(maps, "dnssec-enable", &obj);
Adam Tkac 007ac2
 	INSIST(result == ISC_R_SUCCESS);
Adam Tkac 31f7ce
diff -up bind-9.5.0a7/bin/named/named.conf.5.edns bind-9.5.0a7/bin/named/named.conf.5
Adam Tkac 31f7ce
--- bind-9.5.0a7/bin/named/named.conf.5.edns	2007-10-22 00:15:32.000000000 +0200
Adam Tkac 31f7ce
+++ bind-9.5.0a7/bin/named/named.conf.5	2007-11-15 12:32:12.000000000 +0100
Adam Tkac 007ac2
@@ -160,6 +160,7 @@ options {
Adam Tkac 007ac2
 	datasize \fIsize\fR;
Adam Tkac 007ac2
 	directory \fIquoted_string\fR;
Adam Tkac 007ac2
 	dump\-file \fIquoted_string\fR;
Adam Tkac 007ac2
+	edns \fIboolean\fR;
Adam Tkac 007ac2
 	files \fIsize\fR;
Adam Tkac 007ac2
 	heartbeat\-interval \fIinteger\fR;
Adam Tkac 007ac2
 	host\-statistics \fIboolean\fR; // not implemented