via named.conf (edns-udp-size).
developer: marka
reviewer: explorer
+1432. [func] The advertised EDNS UDP buffer size can now be set
+ via named.conf (edns-udp-size).
+
1431. [bug] isc_print_snprintf() "%s" with precision could walk of
end of arguement. [RT #5191]
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: client.c,v 1.214 2003/01/21 06:11:45 marka Exp $ */
+/* $Id: client.c,v 1.215 2003/02/26 02:03:57 marka Exp $ */
#include <config.h>
#include <dns/events.h>
#include <dns/message.h>
#include <dns/rcode.h>
+#include <dns/resolver.h>
#include <dns/rdata.h>
#include <dns/rdataclass.h>
#include <dns/rdatalist.h>
dns_rdatalist_t *rdatalist;
dns_rdata_t *rdata;
isc_result_t result;
+ dns_view_t *view;
+ dns_resolver_t *resolver;
+ isc_uint16_t udpsize;
REQUIRE(client->opt == NULL); /* XXXRTH free old. */
/*
* Set the maximum UDP buffer size.
*/
- rdatalist->rdclass = RECV_BUFFER_SIZE;
+ view = client->view;
+ resolver = (view != NULL) ? view->resolver : NULL;
+ if (resolver != NULL)
+ udpsize = dns_resolver_getudpsize(resolver);
+ else
+ udpsize = ns_g_udpsize;
+ rdatalist->rdclass = udpsize;
/*
* Set EXTENDED-RCODE, VERSION and Z to 0.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.c,v 1.37 2003/02/04 06:10:08 marka Exp $ */
+/* $Id: config.c,v 1.38 2003/02/26 02:03:57 marka Exp $ */
#include <config.h>
treat-cr-as-space true;\n\
use-id-pool true;\n\
use-ixfr true;\n\
+ edns-udp-size 4096;\n\
\n\
/* view */\n\
allow-notify {none;};\n\
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: globals.h,v 1.60 2002/11/12 23:38:11 explorer Exp $ */
+/* $Id: globals.h,v 1.61 2003/02/26 02:03:58 marka Exp $ */
#ifndef NAMED_GLOBALS_H
#define NAMED_GLOBALS_H 1
"/resolv.conf");
EXTERN isc_boolean_t ns_g_conffileset INIT(ISC_FALSE);
EXTERN isc_boolean_t lwresd_g_useresolvconf INIT(ISC_FALSE);
+EXTERN isc_uint16_t ns_g_udpsize INIT(4096);
/*
* Initial resource limits.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.394 2003/01/20 23:51:23 marka Exp $ */
+/* $Id: server.c,v 1.395 2003/02/26 02:03:58 marka Exp $ */
#include <config.h>
int i;
char *str;
dns_order_t *order = NULL;
+ isc_uint32_t udpsize;
REQUIRE(DNS_VIEW_VALID(view));
lame_ttl = 1800;
dns_resolver_setlamettl(view->resolver, lame_ttl);
+ /*
+ * Set the resolver's EDNS UDP size.
+ */
+ obj = NULL;
+ result = ns_config_get(maps, "edns-udp-size", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ udpsize = cfg_obj_asuint32(obj);
+ if (udpsize < 512)
+ udpsize = 512;
+ if (udpsize > 4096)
+ udpsize = 4096;
+ dns_resolver_setudpsize(view->resolver, udpsize);
+
/*
* A global or view "forwarders" option, if present,
* creates an entry for "." in the forwarding table.
dns_dispatch_t *dispatchv6 = NULL;
isc_uint32_t interface_interval;
isc_uint32_t heartbeat_interval;
+ isc_uint32_t udpsize;
in_port_t listen_port;
int i;
INSIST(result == ISC_R_SUCCESS);
server->aclenv.match_mapped = cfg_obj_asboolean(obj);
+ /*
+ * Set the EDNS UDP size when we don't match a view.
+ */
+ obj = NULL;
+ result = ns_config_get(maps, "edns-udp-size", &obj);
+ INSIST(result == ISC_R_SUCCESS);
+ udpsize = cfg_obj_asuint32(obj);
+ if (udpsize < 512)
+ udpsize = 512;
+ if (udpsize > 4096)
+ udpsize = 4096;
+ ns_g_udpsize = udpsize;
+
/*
* Configure the zone manager.
*/
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"
"http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
-<!-- File: $Id: Bv9ARM-book.xml,v 1.214 2003/02/07 01:13:11 marka Exp $ -->
+<!-- File: $Id: Bv9ARM-book.xml,v 1.215 2003/02/26 02:03:58 marka Exp $ -->
<book>
<title>BIND 9 Administrator Reference Manual</title>
<optional> max-cache-size <replaceable>size_spec</replaceable> ; </optional>
<optional> match-mapped-addresses <replaceable>yes_or_no</replaceable>; </optional>
<optional> preferred-glue ( <replaceable>A</replaceable> | <replaceable>AAAA</replaceable> | <replaceable>NONE</replaceable> ); </optional>
+ <optional> edns-udp-size <replaceable>number</replaceable>; </optional>
};
</programlisting>
</sect2>
and clamp the SOA refresh and retry times to the specified values.
</para></listitem></varlistentry>
+<varlistentry>
+<term><command>edns-udp-size</command></term>
+<listitem><para>
+<command>edns-udp-size</command> sets the advertised EDNS UDP buffer
+size. Valid values are 512 to 4096 (values outside this range will be
+silently adjusted). The default value is 4096. The usual reason for
+setting edns-udp-size to a non default value it to get UDP answers to
+pass through broken firewalls that block fragmented packets and/or
+block UDP packets that are greater than 512 bytes.
+</para></listitem></varlistentry>
</variablelist>
</sect3>
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.h,v 1.36 2003/01/16 03:59:25 marka Exp $ */
+/* $Id: resolver.h,v 1.37 2003/02/26 02:03:59 marka Exp $ */
#ifndef DNS_RESOLVER_H
#define DNS_RESOLVER_H 1
* only one of 'name' or 'alt' to be valid.
*/
+void
+dns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize);
+/*
+ * Set the EDNS UDP buffer size advertised by the server.
+ */
+
+isc_uint16_t
+dns_resolver_getudpsize(dns_resolver_t *resolver);
+/*
+ * Get the current EDNS UDP buffer size.
+ */
+
ISC_LANG_ENDDECLS
#endif /* DNS_RESOLVER_H */
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.260 2003/01/18 03:18:30 marka Exp $ */
+/* $Id: resolver.c,v 1.261 2003/02/26 02:03:59 marka Exp $ */
#include <config.h>
/*
* Maximum EDNS0 input packet size.
*/
-#define SEND_BUFFER_SIZE 2048 /* XXXRTH Constant. */
+#define RECV_BUFFER_SIZE 4096 /* XXXRTH Constant. */
/*
* This defines the maximum number of timeouts we will permit before we
fctxbucket_t * buckets;
isc_uint32_t lame_ttl;
ISC_LIST(alternate_t) alternates;
+ isc_uint16_t udpsize;
/* Locked by lock. */
unsigned int references;
isc_boolean_t exiting;
}
static inline isc_result_t
-fctx_addopt(dns_message_t *message) {
+fctx_addopt(dns_message_t *message, dns_resolver_t *res) {
dns_rdataset_t *rdataset;
dns_rdatalist_t *rdatalist;
dns_rdata_t *rdata;
/*
* Set Maximum UDP buffer size.
*/
- rdatalist->rdclass = SEND_BUFFER_SIZE;
+ rdatalist->rdclass = res->udpsize;
/*
* Set EXTENDED-RCODE, VERSION, and Z to 0, and the DO bit to 1.
if ((query->options & DNS_FETCHOPT_NOEDNS0) == 0) {
if ((query->addrinfo->flags & DNS_FETCHOPT_NOEDNS0) == 0) {
- result = fctx_addopt(fctx->qmessage);
+ result = fctx_addopt(fctx->qmessage, res);
if (result != ISC_R_SUCCESS) {
/*
* We couldn't add the OPT, but we'll press on.
res->options = options;
res->lame_ttl = 0;
ISC_LIST_INIT(res->alternates);
+ res->udpsize = RECV_BUFFER_SIZE;
res->nbuckets = ntasks;
res->activebuckets = ntasks;
return (ISC_R_SUCCESS);
}
+
+void
+dns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize) {
+ REQUIRE(VALID_RESOLVER(resolver));
+ resolver->udpsize = udpsize;
+}
+
+isc_uint16_t
+dns_resolver_getudpsize(dns_resolver_t *resolver) {
+ REQUIRE(VALID_RESOLVER(resolver));
+ return (resolver->udpsize);
+}
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: namedconf.c,v 1.15 2003/02/04 06:10:09 marka Exp $ */
+/* $Id: namedconf.c,v 1.16 2003/02/26 02:04:00 marka Exp $ */
#include <config.h>
{ "suppress-initial-notify", &cfg_type_boolean, CFG_CLAUSEFLAG_NYI },
{ "preferred-glue", &cfg_type_astring, 0 },
{ "dual-stack-servers", &cfg_type_nameportiplist, 0 },
+ { "edns-udp-size", &cfg_type_uint32, 0 },
{ NULL, NULL, 0 }
};