]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Implement dig +[no]svcparamkeycompat
authorAram Sargsyan <aram@isc.org>
Mon, 10 Feb 2025 13:22:58 +0000 (13:22 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Mon, 17 Feb 2025 17:33:43 +0000 (17:33 +0000)
The new +[no]svcparamkeycompat option for dig enables the
backward-compatible mode for the Service Parameter Keys'
(SvcParamKeys) representation format. See the previous commit
for more information.

bin/dig/dig.c
bin/dig/dig.rst
bin/dig/dighost.c
bin/dig/dighost.h

index f6783deb4812411d3f2a7edeb3f4fcb05c2cb317..67056ec490b02d16ab48bb2ee813f0c6b2ee9783 100644 (file)
@@ -303,6 +303,8 @@ help(void) {
               "statistics)\n"
               "                 +subnet=addr        (Set edns-client-subnet "
               "option)\n"
+              "                 +[no]svcparamkeycompat (Display backward-"
+              "compatible SvcParamKey names (keyN) for non-initial entries)\n"
               "                 +[no]tcflag         (Set TC flag in query "
               "(+[no]tcflag))\n"
               "                 +[no]tcp            (TCP mode (+[no]vc))\n"
@@ -502,6 +504,9 @@ say_message(dns_rdata_t *rdata, dig_query_t *query, isc_buffer_t *buf) {
        if (query->lookup->expandaaaa) {
                styleflags |= DNS_STYLEFLAG_EXPANDAAAA;
        }
+       if (query->lookup->svcparamkeycompat) {
+               styleflags |= DNS_STYLEFLAG_SVCPARAMKEYCOMPAT;
+       }
        result = dns_rdata_tofmttext(rdata, NULL, styleflags, 0, splitwidth,
                                     " ", buf);
        if (result == ISC_R_NOSPACE) {
@@ -695,6 +700,9 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
                if (query->lookup->expandaaaa) {
                        styleflags |= DNS_STYLEFLAG_EXPANDAAAA;
                }
+               if (query->lookup->svcparamkeycompat) {
+                       styleflags |= DNS_STYLEFLAG_SVCPARAMKEYCOMPAT;
+               }
                if (query->lookup->multiline) {
                        styleflags |= DNS_STYLEFLAG_OMIT_OWNER;
                        styleflags |= DNS_STYLEFLAG_OMIT_CLASS;
@@ -2394,6 +2402,10 @@ plus_option(char *option, bool is_batchfile, bool *need_clone,
                                goto exit_or_usage;
                        }
                        break;
+               case 'v': /* svcparamkeycompat */
+                       FULLCHECK("svcparamkeycompat");
+                       lookup->svcparamkeycompat = state;
+                       break;
                default:
                        goto invalid_option;
                }
index 90c4a8dc96eac313bb69a834555d22ed44d11eb0..fa436fefacfe2381ef5dd19fcff200a5f74acde5 100644 (file)
@@ -642,6 +642,14 @@ abbreviation is unambiguous; for example, :option:`+cd` is equivalent to
    prefix-length of zero, which signals a resolver that the client's
    address information must *not* be used when resolving this query.
 
+.. option:: +svcparamkeycompat, +nosvcparamkeycompat
+
+   This option sets [or does not set] the backward-compatible representation of
+   the Service Parameter Keys (SvcParamKeys) for SVCB records, in which case
+   the keys, which were not defined initially in :rfc:`9460` are represented
+   in their opaque "keyN"-like format, where "N" is their numerical value. The
+   default is ``+nosvcparamkeycompat``.
+
 .. option:: +tcflag, +notcflag
 
    This option sets [or does not set] the TC (TrunCation) bit in the query. The default is
index b491ebb27a81ee096f11d66ebb5105d9139aefd8..8c25504782cdb3f1d26adf76f03111c174a2a352 100644 (file)
@@ -758,6 +758,7 @@ clone_lookup(dig_lookup_t *lookold, bool servers) {
        looknew->nocrypto = lookold->nocrypto;
        looknew->ttlunits = lookold->ttlunits;
        looknew->expandaaaa = lookold->expandaaaa;
+       looknew->svcparamkeycompat = lookold->svcparamkeycompat;
        looknew->qr = lookold->qr;
        looknew->idnin = lookold->idnin;
        looknew->idnout = lookold->idnout;
index 81ce6b609d0eecb8cab16064c1b963f3eb47341b..1c5c7ddf9456821a1a39910236157baccd7735e9 100644 (file)
@@ -104,9 +104,8 @@ struct dig_lookup {
        isc_refcount_t references;
        bool aaonly, adflag, badcookie, besteffort, cdflag, cleared, comments,
                dns64prefix, dnssec, doing_xfr, done_as_is, ednsneg, expandaaaa,
-               expire, fuzzing, header_only, identify, /*%< Append an "on
-                                                          server <foo>" message
-                                                        */
+               svcparamkeycompat, expire, fuzzing, header_only,
+               identify, /*%< Append an "on server <foo>" message */
                identify_previous_line, /*% Prepend a "Nameserver <foo>:"
                                           message, with newline and tab */
                idnin, idnout, ignore, multiline, need_search, new_search,