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

4688. [protocol] Check and display EDNS KEY TAG options (RFC 8145) in

messages. [RT #44804]
This commit is contained in:
Mark Andrews
2017-08-25 08:38:19 +10:00
parent af4b4bef7a
commit 07741d43c8
7 changed files with 74 additions and 4 deletions

View File

@@ -3608,6 +3608,23 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg,
} else if (optcode == DNS_OPT_PAD) {
INDENT(style);
ADD_STRING(target, "PAD");
} else if (optcode == DNS_OPT_KEY_TAG) {
INDENT(style);
ADD_STRING(target, "KEY-TAG");
if (optlen > 0U && (optlen % 2U) == 0U) {
const char *sep = ": ";
isc_uint16_t id;
while (optlen > 0U) {
id = isc_buffer_getuint16(&optbuf);
snprintf(buf, sizeof(buf), "%s%u",
sep, id);
ADD_STRING(target, buf);
sep = ", ";
optlen -= 2;
}
ADD_STRING(target, "\n");
continue;
}
} else {
INDENT(style);
ADD_STRING(target, "OPT: ");
@@ -3860,6 +3877,22 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
}
ADD_STRING(target, "\n");
continue;
} else if (optcode == DNS_OPT_KEY_TAG) {
ADD_STRING(target, "; KEY-TAG");
if (optlen > 0U && (optlen % 2U) == 0U) {
const char *sep = ": ";
isc_uint16_t id;
while (optlen > 0U) {
id = isc_buffer_getuint16(&optbuf);
snprintf(buf, sizeof(buf), "%s%u",
sep, id);
ADD_STRING(target, buf);
sep = ", ";
optlen -= 2;
}
ADD_STRING(target, "\n");
continue;
}
} else {
ADD_STRING(target, "; OPT=");
snprintf(buf, sizeof(buf), "%u", optcode);