2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 07:35:26 +00:00

Add support for displaying EDNS option LLQ.

This commit is contained in:
Mark Andrews
2019-08-27 13:49:15 +10:00
parent c8ed70a108
commit d98f446d3f
6 changed files with 79 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
5280. [protocol] Add support for displaying EDNS option LLQ. [GL #1201]
5279. [bug] When loading, reject zones containing CDS or CDNSKEY 5279. [bug] When loading, reject zones containing CDS or CDNSKEY
RRsets at the zone apex if they would cause DNSSEC RRsets at the zone apex if they would cause DNSSEC
validation failures if published in the parent zone validation failures if published in the parent zone

View File

@@ -1383,6 +1383,7 @@ typedef struct dig_ednsoptname {
} dig_ednsoptname_t; } dig_ednsoptname_t;
dig_ednsoptname_t optnames[] = { dig_ednsoptname_t optnames[] = {
{ 1, "LLQ" }, /* draft-sekar-dns-llq */
{ 3, "NSID" }, /* RFC 5001 */ { 3, "NSID" }, /* RFC 5001 */
{ 5, "DAU" }, /* RFC 6975 */ { 5, "DAU" }, /* RFC 6975 */
{ 6, "DHU" }, /* RFC 6975 */ { 6, "DHU" }, /* RFC 6975 */

View File

@@ -519,6 +519,14 @@ if [ -x "$DIG" ] ; then
if [ $ret -ne 0 ]; then echo_i "failed"; fi if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret)) status=$((status+ret))
n=$((n+1))
echo_i "checking ednsopt LLQ prints as expected ($n)"
ret=0
dig_with_opts @10.53.0.3 +ednsopt=llq:0001000200001234567812345678fefefefe +qr a.example > dig.out.test$n 2>&1 || ret=1
grep 'LLQ: Version: 1, Opcode: 2, Error: 0, Identifier: 1311768465173141112, Lifetime: 4278124286$' dig.out.test$n > /dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status+ret))
n=$((n+1)) n=$((n+1))
echo_i "checking that dig warns about .local queries ($n)" echo_i "checking that dig warns about .local queries ($n)"
ret=0 ret=0

View File

@@ -99,6 +99,7 @@
#define DNS_MESSAGEEXTFLAG_DO 0x8000U #define DNS_MESSAGEEXTFLAG_DO 0x8000U
/*%< EDNS0 extended OPT codes */ /*%< EDNS0 extended OPT codes */
#define DNS_OPT_LLQ 1 /*%< LLQ opt code */
#define DNS_OPT_NSID 3 /*%< NSID opt code */ #define DNS_OPT_NSID 3 /*%< NSID opt code */
#define DNS_OPT_CLIENT_SUBNET 8 /*%< client subnet opt code */ #define DNS_OPT_CLIENT_SUBNET 8 /*%< client subnet opt code */
#define DNS_OPT_EXPIRE 9 /*%< EXPIRE opt code */ #define DNS_OPT_EXPIRE 9 /*%< EXPIRE opt code */

View File

@@ -3427,6 +3427,42 @@ render_ecs(isc_buffer_t *ecsbuf, isc_buffer_t *target) {
return (result); return (result);
} }
static isc_result_t
render_llq(isc_buffer_t *optbuf, isc_buffer_t *target) {
char buf[sizeof("18446744073709551615")]; /* 2^64-1 */
isc_result_t result = ISC_R_SUCCESS;
uint32_t u;
uint64_t q;
u = isc_buffer_getuint16(optbuf);
ADD_STRING(target, " Version: ");
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
u = isc_buffer_getuint16(optbuf);
ADD_STRING(target, ", Opcode: ");
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
u = isc_buffer_getuint16(optbuf);
ADD_STRING(target, ", Error: ");
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
q = isc_buffer_getuint32(optbuf);
q <<= 32;
q |= isc_buffer_getuint32(optbuf);
ADD_STRING(target, ", Identifier: ");
snprintf(buf, sizeof(buf), "%" PRIu64, q);
ADD_STRING(target, buf);
u = isc_buffer_getuint32(optbuf);
ADD_STRING(target, ", Lifetime: ");
snprintf(buf, sizeof(buf), "%u", u);
ADD_STRING(target, buf);
cleanup:
return (result);
}
static isc_result_t static isc_result_t
dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_message_pseudosectiontoyaml(dns_message_t *msg,
@@ -3513,7 +3549,19 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg,
optlen = isc_buffer_getuint16(&optbuf); optlen = isc_buffer_getuint16(&optbuf);
INSIST(isc_buffer_remaininglength(&optbuf) >= optlen); INSIST(isc_buffer_remaininglength(&optbuf) >= optlen);
if (optcode == DNS_OPT_NSID) { if (optcode == DNS_OPT_LLQ) {
INDENT(style);
if (optlen == 18U) {
ADD_STRING(target, "LLQ: ");
result = render_llq(&optbuf, target);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
ADD_STRING(target, "\n");
continue;
}
ADD_STRING(target, "LLQ");
} else if (optcode == DNS_OPT_NSID) {
INDENT(style); INDENT(style);
ADD_STRING(target, "NSID"); ADD_STRING(target, "NSID");
} else if (optcode == DNS_OPT_COOKIE) { } else if (optcode == DNS_OPT_COOKIE) {
@@ -3795,7 +3843,18 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
INDENT(style); INDENT(style);
if (optcode == DNS_OPT_NSID) { if (optcode == DNS_OPT_LLQ) {
if (optlen == 18U) {
ADD_STRING(target, "; LLQ:");
result = render_llq(&optbuf, target);
if (result != ISC_R_SUCCESS) {
return (result);
}
ADD_STRING(target, "\n");
continue;
}
ADD_STRING(target, "; LLQ");
} else if (optcode == DNS_OPT_NSID) {
ADD_STRING(target, "; NSID"); ADD_STRING(target, "; NSID");
} else if (optcode == DNS_OPT_COOKIE) { } else if (optcode == DNS_OPT_COOKIE) {
ADD_STRING(target, "; COOKIE"); ADD_STRING(target, "; COOKIE");

View File

@@ -116,6 +116,12 @@ fromwire_opt(ARGS_FROMWIRE) {
return (ISC_R_UNEXPECTEDEND); return (ISC_R_UNEXPECTEDEND);
} }
switch (opt) { switch (opt) {
case DNS_OPT_LLQ:
if (length != 18U) {
return (DNS_R_OPTERR);
}
isc_region_consume(&sregion, length);
break;
case DNS_OPT_CLIENT_SUBNET: { case DNS_OPT_CLIENT_SUBNET: {
uint16_t family; uint16_t family;
uint8_t addrlen; uint8_t addrlen;