Commit 25a9b903 authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] symbolic option names for dig +ednsopt

4555.	[func]		dig +ednsopt: EDNS options can now be specified by
			name in addition to numeric value. [RT #44461]
parent 31c2480c
4555. [func] dig +ednsopt: EDNS options can now be specified by
name in addition to numeric value. [RT #44461]
4554. [bug] Remove double unlock in dns_dispatchmgr_setudp.
[RT #44336]
......
......@@ -708,7 +708,10 @@
<para>
Specify EDNS option with code point <option>code</option>
and optionally payload of <option>value</option> as a
hexadecimal string. <option>+noednsopt</option>
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>
......
......@@ -1590,18 +1590,52 @@ setup_libs(void) {
static dns_ednsopt_t ednsopts[EDNSOPT_OPTIONS];
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 == EDNSOPT_OPTIONS)
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;
......
......@@ -6,8 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// NS4
controls { /* empty */ };
options {
......@@ -20,6 +18,7 @@ options {
acache-enable yes;
dnssec-enable no;
dnssec-validation no;
server-id "ns3";
};
zone "." {
......
......@@ -384,6 +384,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
......
......@@ -119,6 +119,15 @@
<section xml:id="relnotes_features"><info><title>New Features</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>
Added support for the EDNS TCP Keepalive option (RFC 7828);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment