diff --git a/CHANGES b/CHANGES
index a7ea97bb16..d3ea2e9f4e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -94,6 +94,9 @@
4574. [bug] Dig leaked memory with multiple +subnet options.
[RT #44683]
+4555. [func] dig +ednsopt: EDNS options can now be specified by
+ name in addition to numeric value. [RT #44461]
+
--- 9.10.5 released ---
--- 9.10.5rc3 released ---
diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook
index 577d6d0d23..dbe0765b7a 100644
--- a/bin/dig/dig.docbook
+++ b/bin/dig/dig.docbook
@@ -683,8 +683,11 @@
Specify EDNS option with code point
and optionally payload of as a
- hexadecimal string.
- clears the EDNS options to to be sent.
+ hexadecimal string. can be
+ either an EDNS option name (for example,
+ NSID or ECS),
+ or an arbitrary numeric value.
+ clears the EDNS options to be sent.
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 6ecbc7baa5..6f35540945 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -1539,18 +1539,52 @@ setup_libs(void) {
static dns_ednsopt_t ednsopts[EDNSOPTS];
static unsigned char ednsoptscnt = 0;
+typedef struct dig_ednsoptname {
+ isc_uint32_t code;
+ const char *name;
+} dig_ednsoptname_t;
+
+dig_ednsoptname_t optnames[] = {
+ { 3, "NSID" }, /* RFC 5001 */
+ { 5, "DAU" }, /* RFC 6975 */
+ { 6, "DHU" }, /* RFC 6975 */
+ { 7, "N3U" }, /* RFC 6975 */
+ { 8, "ECS" }, /* RFC 7871 */
+ { 9, "EXPIRE" }, /* RFC 7314 */
+ { 10, "COOKIE" }, /* RFC 7873 */
+ { 11, "KEEPALIVE" }, /* RFC 7828 */
+ { 12, "PADDING" }, /* RFC 7830 */
+ { 12, "PAD" }, /* shorthand */
+ { 13, "CHAIN" }, /* RFC 7901 */
+ { 26946, "DEVICEID" }, /* Brian Hartvigsen */
+};
+
+#define N_EDNS_OPTNAMES (sizeof(optnames) / sizeof(optnames[0]))
+
void
save_opt(dig_lookup_t *lookup, char *code, char *value) {
+ isc_result_t result;
isc_uint32_t num;
isc_buffer_t b;
- isc_result_t result;
+ isc_boolean_t found = ISC_FALSE;
+ unsigned int i;
if (ednsoptscnt == EDNSOPTS)
fatal("too many ednsopts");
- result = parse_uint(&num, code, 65535, "ednsopt");
- if (result != ISC_R_SUCCESS)
- fatal("bad edns code point: %s", code);
+ for (i = 0; i < N_EDNS_OPTNAMES; i++) {
+ if (strcasecmp(code, optnames[i].name) == 0) {
+ num = optnames[i].code;
+ found = ISC_TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ result = parse_uint(&num, code, 65535, "ednsopt");
+ if (result != ISC_R_SUCCESS)
+ fatal("bad edns code point: %s", code);
+ }
ednsopts[ednsoptscnt].code = num;
ednsopts[ednsoptscnt].length = 0;
diff --git a/bin/tests/system/digdelv/ns3/named.conf b/bin/tests/system/digdelv/ns3/named.conf
index 0b64784d4c..fb565e616c 100644
--- a/bin/tests/system/digdelv/ns3/named.conf
+++ b/bin/tests/system/digdelv/ns3/named.conf
@@ -14,8 +14,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-// NS4
-
controls { /* empty */ };
options {
@@ -28,6 +26,7 @@ options {
acache-enable yes;
dnssec-enable no;
dnssec-validation no;
+ server-id "ns3";
};
zone "." {
diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh
index 7530b6075b..cc2aaf130f 100644
--- a/bin/tests/system/digdelv/tests.sh
+++ b/bin/tests/system/digdelv/tests.sh
@@ -247,6 +247,22 @@ if [ -x ${DIG} ] ; then
if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
+ n=`expr $n + 1`
+ echo "I:checking dig +ednsopt with option number ($n)"
+ ret=0
+ $DIG $DIGOPTS @10.53.0.3 +ednsopt=3 a.example > dig.out.test$n 2>&1 || ret=1
+ grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
+ if [ $ret != 0 ]; then echo "I:failed"; fi
+ status=`expr $status + $ret`
+
+ n=`expr $n + 1`
+ echo "I:checking dig +ednsopt with option name ($n)"
+ ret=0
+ $DIG $DIGOPTS @10.53.0.3 +ednsopt=nsid a.example > dig.out.test$n 2>&1 || ret=1
+ grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
+ if [ $ret != 0 ]; then echo "I:failed"; fi
+ status=`expr $status + $ret`
+
n=`expr $n + 1`
if $FEATURETEST --with-idn
then
diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml
index f25f2b11da..7625e27c33 100644
--- a/doc/arm/notes.xml
+++ b/doc/arm/notes.xml
@@ -79,6 +79,15 @@
Feature Changes
+
+
+ dig +ednsopt now accepts the names
+ for EDNS options in addition to numeric values. For example,
+ an EDNS Client-Subnet option could be sent using
+ dig +ednsopt=ecs:.... Thanks to
+ John Worley of Secure64 for the contribution. [RT #44461]
+
+
Threads in named are now set to human-readable