<para>
Specify EDNS option with code point <option>code</option>
and optionally payload of <option>value</option> as a
- hexadecimal string. <option>+noednsopt</option>
- clears the EDNS options to to be sent.
+ hexadecimal string. <option>code</option> can be
+ either an EDNS option name (for example,
+ <literal>NSID</literal> or <literal>ECS</literal>),
+ or an arbitrary numeric value. <option>+noednsopt</option>
+ clears the EDNS options to be sent.
</para>
</listitem>
</varlistentry>
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;
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
<section xml:id="relnotes_changes"><info><title>Feature Changes</title></info>
<itemizedlist>
+ <listitem>
+ <para>
+ <command>dig +ednsopt</command> now accepts the names
+ for EDNS options in addition to numeric values. For example,
+ an EDNS Client-Subnet option could be sent using
+ <command>dig +ednsopt=ecs:...</command>. Thanks to
+ John Worley of Secure64 for the contribution. [RT #44461]
+ </para>
+ </listitem>
<listitem>
<para>
Threads in <command>named</command> are now set to human-readable