From d5b9e6790fbff5f579a786552f6e2533a80fe2fc Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 30 Oct 2024 13:35:58 +1100 Subject: [PATCH] Fix EDNS TCP-KEEPALIVE option YAML output There was missing white space between the option name and its value. (cherry picked from commit 07c28652a3aaaf9ca413655375ec0cc3d6cc1c32) --- bin/tests/system/digdelv/tests.sh | 21 +++++++++++++++++++++ lib/dns/message.c | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 51e6992416..cd9d45bcc7 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -764,6 +764,27 @@ if [ -x "$DIG" ]; then status=$((status + ret)) fi + n=$((n + 1)) + echo_i "check that dig processes +expire ($n)" + ret=0 + dig_with_opts @10.53.0.1 +expire . soa >dig.out.test$n 2>&1 || ret=1 + grep '; EXPIRE: 1200 (20 minutes)' dig.out.test$n >/dev/null || ret=1 + if [ $ret -ne 0 ]; then echo_i "failed"; fi + status=$((status + ret)) + + if [ $HAS_PYYAML -ne 0 ]; then + n=$((n + 1)) + echo_i "check that dig processes +expire +yaml ($n)" + ret=0 + dig_with_opts @10.53.0.1 +yaml +expire . soa >dig.out.test$n 2>&1 || ret=1 + $PYTHON yamlget.py dig.out.test$n 0 message response_message_data OPT_PSEUDOSECTION EDNS EXPIRE >yamlget.out.test$n 2>&1 || ret=1 + read -r value /dev/null || ret=1 + if [ $ret -ne 0 ]; then echo_i "failed"; fi + status=$((status + ret)) + fi + n=$((n + 1)) echo_i "check that Extended DNS Error 0 is printed correctly ($n)" ret=0 diff --git a/lib/dns/message.c b/lib/dns/message.c index 1c9b6dca3d..c5603c03ae 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -3872,7 +3872,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg, dns_pseudosection_t section, if (optlen == 2) { unsigned int dsecs; dsecs = isc_buffer_getuint16(&optbuf); - snprintf(buf, sizeof(buf), "%u.%u", + snprintf(buf, sizeof(buf), " %u.%u", dsecs / 10U, dsecs % 10U); ADD_STRING(target, buf); ADD_STRING(target, " secs\n");