[v9_10] 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] (cherry picked from commit25a9b90369) (cherry picked from commit403e7b4512)
This commit is contained in:
@@ -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 ---
|
||||
|
||||
+5
-2
@@ -683,8 +683,11 @@
|
||||
<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>
|
||||
|
||||
+38
-4
@@ -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;
|
||||
|
||||
@@ -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 "." {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -79,6 +79,15 @@
|
||||
|
||||
<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
|
||||
|
||||
Reference in New Issue
Block a user