+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]
"responses)\n"
" +[no]besteffort (Try to parse even illegal "
"messages)\n"
- " +bufsize=### (Set EDNS0 Max UDP packet "
+ " +bufsize[=###] (Set EDNS0 Max UDP packet "
"size)\n"
" +[no]cdflag (Set checking disabled "
"flag in query)\n"
break;
case 'u': /* bufsize */
FULLCHECK("bufsize");
- if (value == NULL) {
- goto need_value;
- }
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) {
goto exit_or_usage;
}
lookup->udpsize = num;
+ if (lookup->udpsize == 0) {
+ lookup->edns = -1;
+ }
break;
default:
goto invalid_option;
case 'o': /* cookie */
FULLCHECK("cookie");
if (state && lookup->edns == -1) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->sendcookie = state;
if (value != NULL) {
FULLCHECK("dnssec");
dnssec:
if (state && lookup->edns == -1) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->dnssec = state;
break;
break;
}
if (value == NULL) {
- lookup->edns = 0;
+ lookup->edns =
+ DEFAULT_EDNS_VERSION;
break;
}
result = parse_uint(&num, value,
case 'i': /* nsid */
FULLCHECK("nsid");
if (state && lookup->edns == -1) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
lookup->nsid = state;
break;
case 'p':
FULLCHECK("padding");
if (state && lookup->edns == -1) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
if (value == NULL) {
goto need_value;
break;
}
if (lookup->edns == -1) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
if (lookup->ecs_addr != NULL) {
isc_mem_free(mctx, lookup->ecs_addr);
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
Attempt to display the contents of messages which are malformed. The
default is to not display malformed answers.
-``+bufsize=B``
- Set the UDP message buffer size advertised using EDNS0 to ``B``
- 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.
+``+bufsize[=B]``
+ This option sets the UDP message buffer size advertised using EDNS0
+ to ``B`` bytes. The maximum and minimum sizes of this buffer are
+ 65535 and 0, respectively. ``+bufsize=0`` disables EDNS (use
+ ``+bufsize=0 +edns`` to send a EDNS messages with a advertised size
+ of 0 bytes). ``+bufsize`` restores the default buffer size.
``+[no]cdflag``
Set [do not set] the CD (checking disabled) bit in the query. This
looknew->idnin = false;
looknew->idnout = false;
#endif /* HAVE_LIBIDN2 */
- looknew->udpsize = 0;
+ looknew->udpsize = -1;
looknew->edns = -1;
looknew->recurse = true;
looknew->aaonly = false;
* and DNS_EDNSOPTIONS set by other arguments
* (+nsid, +cookie, etc).
*/
- if (lookup->udpsize == 0) {
- lookup->udpsize = 4096;
+ if (lookup->udpsize < 0) {
+ lookup->udpsize = DEFAULT_EDNS_BUFSIZE;
}
if (lookup->edns < 0) {
- lookup->edns = 0;
+ lookup->edns = DEFAULT_EDNS_VERSION;
}
if (lookup->nsid) {
#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;
int16_t padding;
uint32_t ixfr_serial;
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;
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
+ n=$((n+1))
+ echo_i "check that dig +bufsize=0 disables EDNS ($n)"
+ ret=0
+ dig_with_opts @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=$((status+ret))
+
+ n=$((n+1))
+ echo_i "check that dig +bufsize=0 +edns sends EDNS with bufsize of 0 ($n)"
+ ret=0
+ dig_with_opts @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=$((status+ret))
+
+ n=$((n+1))
+ echo_i "check that dig +bufsize restores default bufsize ($n)"
+ ret=0
+ dig_with_opts @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=$((status+ret))
+
else
echo_i "$DIG is needed, so skipping these dig tests"
fi