]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix EDNS TCP-KEEPALIVE option YAML output
authorMark Andrews <marka@isc.org>
Wed, 30 Oct 2024 02:35:58 +0000 (13:35 +1100)
committerMark Andrews <marka@isc.org>
Mon, 21 Apr 2025 23:24:18 +0000 (09:24 +1000)
There was missing white space between the option name and its value.

bin/tests/system/digdelv/tests.sh
lib/dns/message.c

index 52e15e1b90fa58a13d51093f33d135fc046f0234..4050f18ec6d375e09719b9e64e6dfe472532cfca 100644 (file)
@@ -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 <yamlget.out.test$n
+    [ "$value" = "1200" ] || 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))
+  fi
+
   n=$((n + 1))
   echo_i "check that Extended DNS Error 0 is printed correctly ($n)"
   ret=0
index 96f487469e1dc32748e4d9888637eed21fb5b82d..f1e7079aae6bfb7bcb3b5e8f47fc6be59abc22f7 100644 (file)
@@ -3829,7 +3829,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");