mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Change the EDNS KEY-TAG YAML output format
When using YAML, print the EDNS KEY-TAG as an array of integers for easier machine parsing. Check the validity of the YAML output.
This commit is contained in:
@@ -645,6 +645,18 @@ 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))
|
||||||
|
|
||||||
|
if [ $HAS_PYYAML -ne 0 ]; then
|
||||||
|
n=$((n + 1))
|
||||||
|
ret=0
|
||||||
|
echo_i "check that dig processes +ednsopt=key-tag:<value-list> +yaml ($n)"
|
||||||
|
dig_with_opts @10.53.0.3 +yaml +ednsopt=key-tag:00010002 a.example +qr >dig.out.test$n 2>&1 || ret=1
|
||||||
|
$PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS KEY-TAG >yamlget.out.test$n 2>&1 || ret=1
|
||||||
|
read -r value <yamlget.out.test$n
|
||||||
|
[ "$value" = "[1, 2]" ] || ret=1
|
||||||
|
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||||
|
status=$((status + ret))
|
||||||
|
fi
|
||||||
|
|
||||||
n=$((n + 1))
|
n=$((n + 1))
|
||||||
echo_i "check that dig processes +ednsopt=key-tag:<malformed-value-list> and FORMERR is returned ($n)"
|
echo_i "check that dig processes +ednsopt=key-tag:<malformed-value-list> and FORMERR is returned ($n)"
|
||||||
ret=0
|
ret=0
|
||||||
|
@@ -3809,7 +3809,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
|
|||||||
break;
|
break;
|
||||||
case DNS_OPT_KEY_TAG:
|
case DNS_OPT_KEY_TAG:
|
||||||
if (optlen > 0U && (optlen % 2U) == 0U) {
|
if (optlen > 0U && (optlen % 2U) == 0U) {
|
||||||
const char *sep = "";
|
const char *sep = " [";
|
||||||
while (optlen > 0U) {
|
while (optlen > 0U) {
|
||||||
uint16_t id =
|
uint16_t id =
|
||||||
isc_buffer_getuint16(
|
isc_buffer_getuint16(
|
||||||
@@ -3820,7 +3820,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section,
|
|||||||
sep = ",";
|
sep = ",";
|
||||||
optlen -= 2;
|
optlen -= 2;
|
||||||
}
|
}
|
||||||
ADD_STRING(target, "\n");
|
ADD_STRING(target, " ]\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user