From: Aram Sargsyan Date: Mon, 10 Feb 2025 13:22:58 +0000 (+0000) Subject: Implement dig +[no]svcparamkeycompat X-Git-Tag: ondrej/lock-free-qpzone-reads-v1~58^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=583a838c2553b4ea52b26430d682b551d8a303c1;p=thirdparty%2Fbind9.git Implement dig +[no]svcparamkeycompat 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. --- diff --git a/bin/dig/dig.c b/bin/dig/dig.c index f6783deb481..67056ec490b 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -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; } diff --git a/bin/dig/dig.rst b/bin/dig/dig.rst index 90c4a8dc96e..fa436fefacf 100644 --- a/bin/dig/dig.rst +++ b/bin/dig/dig.rst @@ -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 diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index b491ebb27a8..8c25504782c 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -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; diff --git a/bin/dig/dighost.h b/bin/dig/dighost.h index 81ce6b609d0..1c5c7ddf945 100644 --- a/bin/dig/dighost.h +++ b/bin/dig/dighost.h @@ -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 " message - */ + svcparamkeycompat, expire, fuzzing, header_only, + identify, /*%< Append an "on server " message */ identify_previous_line, /*% Prepend a "Nameserver :" message, with newline and tab */ idnin, idnout, ignore, multiline, need_search, new_search,