+5497. [bug] dig +bufsize=0 failed to disable EDNS as a side
+ effect. [GL #2054]
+
5496. [bug] The rate limiter needs to hold a reference to its task.
[GL #2081]
" +[no]authority (Control display of authority section)\n"
" +[no]badcookie (Retry BADCOOKIE responses)\n"
" +[no]besteffort (Try to parse even illegal messages)\n"
-" +bufsize=### (Set EDNS0 Max UDP packet size)\n"
+" +bufsize[=###] (Set EDNS0 Max UDP packet size)\n"
" +[no]cdflag (Set checking disabled flag in query)\n"
" +[no]class (Control display of class in records)\n"
" +[no]cmd (Control display of command line -\n"
break;
case 'u':/* bufsize */
FULLCHECK("bufsize");
- if (value == NULL)
- goto need_value;
- if (!state)
+ if (!state) {
goto invalid_option;
+ }
+ if (value == NULL) {
+ lookup->udpsize = DEFAULT_EDNS_BUFSIZE;
+ break;
+ }
result = parse_uint(&num, value, COMMSIZE,
"buffer size");
if (result != ISC_R_SUCCESS)
fatal("Couldn't parse buffer size");
lookup->udpsize = num;
+ if (lookup->udpsize == 0) {
+ lookup->edns = -1;
+ }
break;
default:
goto invalid_option;
break;
case 'o': /* cookie */
FULLCHECK("cookie");
- if (state && lookup->edns == -1)
- lookup->edns = 0;
+ if (state && lookup->edns == -1) {
+ lookup->edns = DEFAULT_EDNS_VERSION;
+ }
lookup->sendcookie = state;
if (value != NULL) {
n = strlcpy(hexcookie, value,
break;
case 'n': /* dnssec */
FULLCHECK("dnssec");
- if (state && lookup->edns == -1)
- lookup->edns = 0;
+ if (state && lookup->edns == -1) {
+ lookup->edns = DEFAULT_EDNS_VERSION;
+ }
lookup->dnssec = state;
break;
case 'o': /* domain */
break;
}
if (value == NULL) {
- lookup->edns = 0;
+ lookup->edns =
+ DEFAULT_EDNS_VERSION;
break;
}
result = parse_uint(&num,
switch (cmd[2]) {
case 'i': /* nsid */
FULLCHECK("nsid");
- if (state && lookup->edns == -1)
- lookup->edns = 0;
+ if (state && lookup->edns == -1) {
+ lookup->edns = DEFAULT_EDNS_VERSION;
+ }
lookup->nsid = state;
break;
case 's': /* nssearch */
}
break;
}
- if (lookup->edns == -1)
- lookup->edns = 0;
+ if (lookup->edns == -1) {
+ lookup->edns = DEFAULT_EDNS_VERSION;
+ }
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
lookup->ecs_addr = NULL;
debug("making new lookup");
default_lookup = make_empty_lookup();
default_lookup->adflag = true;
- default_lookup->edns = 0;
+ default_lookup->edns = DEFAULT_EDNS_VERSION;
default_lookup->sendcookie = true;
#ifndef NOPOSIX
<term><option>+bufsize=B</option></term>
<listitem>
<para>
- Set the UDP message buffer size advertised using EDNS0
- to <parameter>B</parameter> bytes. The maximum and
- minimum sizes of this buffer are 65535 and 0 respectively.
- Values outside this range are rounded up or down
- appropriately. Values other than zero will cause a
- EDNS query to be sent.
+ This option sets the UDP message buffer size advertised
+ using EDNS0 to <parameter>B</parameter> bytes. The
+ maximum and minimum sizes of this buffer are 65535
+ and 0, respectively. <literal>+bufsize=0</literal>
+ disables EDNS (use <literal>+bufsize=0 +edns</literal>
+ to send a EDNS messages with a advertised size of 0
+ bytes). <literal>+bufsize</literal> restores the
+ default buffer size.
</para>
</listitem>
</varlistentry>
looknew->rdclass_sigchaseset = false;
#endif
#endif
- looknew->udpsize = 0;
+ looknew->udpsize = -1;
looknew->edns = -1;
looknew->recurse = true;
looknew->aaonly = false;
unsigned int flags;
unsigned int i = 0;
- if (lookup->udpsize == 0)
- lookup->udpsize = 4096;
- if (lookup->edns < 0)
- lookup->edns = 0;
+ if (lookup->udpsize < 0) {
+ lookup->udpsize = DEFAULT_EDNS_BUFSIZE;
+ }
+ if (lookup->edns < 0) {
+ lookup->edns = DEFAULT_EDNS_VERSION;
+ }
if (lookup->nsid) {
INSIST(i < MAXOPTS);
#define SERVER_TIMEOUT 1
#define LOOKUP_LIMIT 64
+
+#define DEFAULT_EDNS_VERSION 0
+#define DEFAULT_EDNS_BUFSIZE 4096
+
/*%
* Lookup_limit is just a limiter, keeping too many lookups from being
* created. It's job is mainly to prevent the program from running away
dig_query_t *xfr_q;
uint32_t retries;
int nsfound;
- uint16_t udpsize;
+ int16_t udpsize;
int16_t edns;
uint32_t ixfr_serial;
isc_buffer_t rdatabuf;
lookup->recurse = recurse;
lookup->aaonly = aaonly;
lookup->retries = tries;
- lookup->udpsize = 0;
lookup->comments = comments;
if (lookup->rdtype == dns_rdatatype_any && !tcpmode_set)
lookup->tcp_mode = true;
pat='^;-m\..*IN.*A$'
tr -d '\r' < dig.out.test$n | grep "$pat" > /dev/null || ret=1
grep "Dump of all outstanding memory allocations" dig.out.test$n > /dev/null && ret=1
- if [ $ret != 0 ]; then echo_i "failed"; fi
+ if [ $ret -ne 0 ]; then echo_i "failed"; fi
+ status=`expr $status + $ret`
+
+ n=$((n+1))
+ echo_i "check that dig +bufsize=0 disables EDNS ($n)"
+ ret=0
+ $DIG $DIGOPTS @10.53.0.3 a.example +bufsize=0 +qr > dig.out.test$n 2>&1 || ret=1
+ grep "EDNS:" dig.out.test$n > /dev/null && ret=1
+ if [ $ret -ne 0 ]; then echo_i "failed"; fi
+ status=`expr $status + $ret`
+
+ n=$((n+1))
+ echo_i "check that dig +bufsize=0 +edns sends EDNS with bufsize of 0 ($n)"
+ ret=0
+ $DIG $DIGOPTS @10.53.0.3 a.example +bufsize=0 +edns +qr > dig.out.test$n 2>&1 || ret=1
+ grep -E 'EDNS:.* udp: 0\r{0,1}$' dig.out.test$n > /dev/null|| ret=1
+ if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+
+ n=$((n+1))
+ echo_i "check that dig +bufsize restores default bufsize ($n)"
+ ret=0
+ $DIG $DIGOPTS @10.53.0.3 a.example +bufsize=0 +bufsize +qr > dig.out.test$n 2>&1 || ret=1
+ lines=`grep "EDNS:.* udp: 4096" dig.out.test$n | wc -l`
+ test $lines -eq 2 || ret=1
+ if [ $ret -ne 0 ]; then echo_i "failed"; fi
+ status=`expr $status + $ret`
+
else
echo_i "$DIG is needed, so skipping these dig tests"
fi