2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Change the name and YAML format of EDNS UL

The offical EDNS option name for "UL" is "UPDATE-LEASE".  We now
emit "UPDATE-LEASE" instead of "UL", when printing messages, but
"UL" has been retained as an alias on the command line.

Update leases consist of 1 or 2 values, LEASE and KEY-LEASE.  These
components are now emitted separately so they can be easily extracted
from YAML output.  Tests have been added to check YAML correctness.
This commit is contained in:
Mark Andrews
2024-10-29 14:32:54 +11:00
parent 280e9b7cf4
commit 68cdc4774c
3 changed files with 56 additions and 17 deletions

View File

@@ -3476,7 +3476,7 @@ cleanup:
static const char *option_names[] = {
[DNS_OPT_LLQ] = "LLQ",
[DNS_OPT_UL] = "UL",
[DNS_OPT_UL] = "UPDATE-LEASE",
[DNS_OPT_NSID] = "NSID",
[DNS_OPT_DAU] = "DAU",
[DNS_OPT_DHU] = "DHU",
@@ -3711,32 +3711,44 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
case DNS_OPT_UL:
if (optlen == 4U || optlen == 8U) {
uint32_t secs, key = 0;
msg->indent.count++;
secs = isc_buffer_getuint32(&optbuf);
ADD_STRING(target, "\n");
INDENT(style);
ADD_STRING(target, "LEASE:");
snprintf(buf, sizeof(buf), " %u", secs);
ADD_STRING(target, buf);
if (optlen == 8U) {
key = isc_buffer_getuint32(
&optbuf);
snprintf(buf, sizeof(buf),
"/%u", key);
ADD_STRING(target, buf);
}
ADD_STRING(target, " (");
result = dns_ttl_totext(secs, true,
true, target);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
ADD_STRING(target, ")");
if (optlen == 8U) {
ADD_STRING(target, "/");
key = isc_buffer_getuint32(
&optbuf);
ADD_STRING(target, "\n");
INDENT(style);
ADD_STRING(target,
"KEY-LEASE:");
snprintf(buf, sizeof(buf),
" %u", key);
ADD_STRING(target, buf);
ADD_STRING(target, " (");
result = dns_ttl_totext(
key, true, true,
target);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
ADD_STRING(target, ")");
}
ADD_STRING(target, ")\n");
ADD_STRING(target, "\n");
continue;
}
break;