]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3561. [bug] dig: issue a warning if an EDNS query returns FORMERR
authorMark Andrews <marka@isc.org>
Wed, 1 May 2013 04:53:16 +0000 (14:53 +1000)
committerMark Andrews <marka@isc.org>
Wed, 1 May 2013 04:56:51 +0000 (14:56 +1000)
                        or NOTIMP.  Adjust usage message. [RT #33363]
(cherry picked from commit 93aba6dcec9855cd9c69c10717f62c350ff766ea)

CHANGES
bin/dig/dig.c

diff --git a/CHANGES b/CHANGES
index 8af07ae356f48542ebb42b26a98968254e60a664..32ef210deca923204dff5fb8d469fa31d7607d53 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3561.  [bug]           dig: issue a warning if an EDNS query returns FORMERR
+                       or NOTIMP.  Adjust usage message. [RT #33363]
+                       
        --- 9.8.5rc1 released ---
 
 3560.  [bug]           isc-config.sh did not honour includedir and libdir
index 5a42a13df2cb0c778b59b56edd42869a931394fa..ce9ccdeee302b303b6177460ed87dbbdb5346e0d 100644 (file)
@@ -186,7 +186,7 @@ help(void) {
 "                 +domain=###         (Set default domainname)\n"
 "                 +bufsize=###        (Set EDNS0 Max UDP packet size)\n"
 "                 +ndots=###          (Set NDOTS value)\n"
-"                 +edns=###           (Set EDNS version)\n"
+"                 +[no]edns[=###]     (Set EDNS version) [0]\n"
 "                 +[no]search         (Set whether to use searchlist)\n"
 "                 +[no]showsearch     (Search with intermediate results)\n"
 "                 +[no]defname        (Ditto)\n"
@@ -529,6 +529,13 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
                                printf(";; WARNING: recursion requested "
                                       "but not available\n");
                }
+               if (msg != query->lookup->sendmsg &&
+                   query->lookup->edns != -1 && msg->opt == NULL &&
+                   (msg->rcode == dns_rcode_formerr ||
+                    msg->rcode == dns_rcode_notimp))
+                       printf("\n;; WARNING: EDNS query returned status "
+                              "%s - retry with '+noedns'\n",
+                              rcode_totext(msg->rcode));
                if (msg != query->lookup->sendmsg && extrabytes != 0U)
                        printf(";; WARNING: Messages has %u extra byte%s at "
                               "end\n", extrabytes, extrabytes != 0 ? "s" : "");
@@ -859,8 +866,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
                        lookup->edns = -1;
                        break;
                }
-               if (value == NULL)
-                       goto need_value;
+               if (value == NULL) {
+                       lookup->edns = 0;
+                       break;
+               }
                result = parse_uint(&num, value, 255, "edns");
                if (result != ISC_R_SUCCESS)
                        fatal("Couldn't parse edns");