From f4d877e7e1175d2de22dc1e60d79cdd680e1c9db Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 29 Oct 2024 14:46:55 +1100 Subject: [PATCH] Split EDNS UL LEASE and KEY-LEASE into seperate YAML values Update leases consist of 1 or 2 values. Give each component its own name so they can be easily extracted. --- bin/tests/system/digdelv/tests.sh | 9 ++++++--- lib/dns/message.c | 30 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index db8c79a517..d4db46f1c6 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -610,7 +610,7 @@ if [ -x "$DIG" ]; then echo_i "checking ednsopt UL prints as expected (single lease) +yaml ($n)" ret=0 dig_with_opts @10.53.0.3 +yaml +ednsopt=UL:00000e10 +qr a.example >dig.out.test$n 2>&1 || ret=1 - $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS UL >yamlget.out.test$n 2>&1 || ret=1 + $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS UL LEASE >yamlget.out.test$n 2>&1 || ret=1 read -r value dig.out.test$n 2>&1 || ret=1 - $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS UL >yamlget.out.test$n 2>&1 || ret=1 + $PYTHON yamlget.py dig.out.test$n 0 message query_message_data OPT_PSEUDOSECTION EDNS UL LEASE >yamlget.out.test$n 2>&1 || ret=1 read -r value yamlget.out.test$n 2>&1 || ret=1 + read -r value 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;