mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-09 07:12:11 -04:00
Use named Service Parameter Keys (SvcParamKeys) by default
When converting SVCB records to text representation use named SvcParamKeys values unless backward-compatible mode is activated, in which case the values which were not defined initially in RFC9460 and were added later (see [1]) are converted to opaque "keyN" syntax, like, for example, "key7" instead of "dohpath". [1] https://www.iana.org/assignments/dns-svcb/dns-svcb.xhtml Co-authored-by: sdomi <ja@sdomi.pl>
This commit is contained in:
parent
5559539eb0
commit
c6e3695478
2 changed files with 11 additions and 5 deletions
|
|
@ -173,6 +173,9 @@ struct dns_rdata {
|
|||
/*% Print AAAA record fully expanded */
|
||||
#define DNS_STYLEFLAG_EXPANDAAAA 0x00000020ULL
|
||||
|
||||
/*% Print non-initial Service Parameter Keys in backward-compatible format */
|
||||
#define DNS_STYLEFLAG_SVCPARAMKEYCOMPAT 0x00000040ULL
|
||||
|
||||
#define DNS_RDATA_DOWNCASE DNS_NAME_DOWNCASE
|
||||
#define DNS_RDATA_CHECKNAMES DNS_NAME_CHECKNAMES
|
||||
#define DNS_RDATA_CHECKNAMESFAIL DNS_NAME_CHECKNAMESFAIL
|
||||
|
|
|
|||
|
|
@ -377,12 +377,12 @@ svc_fromtext(isc_textregion_t *region, isc_buffer_t *target) {
|
|||
|
||||
static const char *
|
||||
svcparamkey(unsigned short value, enum encoding *encoding, char *buf,
|
||||
size_t len) {
|
||||
size_t len, bool compat) {
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sbpr); i++) {
|
||||
if (sbpr[i].value == value && sbpr[i].initial) {
|
||||
if (sbpr[i].value == value && (sbpr[i].initial || !compat)) {
|
||||
*encoding = sbpr[i].encoding;
|
||||
return sbpr[i].name;
|
||||
}
|
||||
|
|
@ -639,6 +639,7 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
|
|||
char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")];
|
||||
unsigned short num;
|
||||
int n;
|
||||
bool compat = (tctx->flags & DNS_STYLEFLAG_SVCPARAMKEYCOMPAT) != 0;
|
||||
|
||||
REQUIRE(rdata->length != 0);
|
||||
|
||||
|
|
@ -674,8 +675,9 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
|
|||
INSIST(region.length >= 2);
|
||||
num = uint16_fromregion(®ion);
|
||||
isc_region_consume(®ion, 2);
|
||||
RETERR(str_totext(svcparamkey(num, &encoding, buf, sizeof(buf)),
|
||||
target));
|
||||
RETERR(str_totext(
|
||||
svcparamkey(num, &encoding, buf, sizeof(buf), compat),
|
||||
target));
|
||||
|
||||
INSIST(region.length >= 2);
|
||||
num = uint16_fromregion(®ion);
|
||||
|
|
@ -747,7 +749,8 @@ generic_totext_in_svcb(ARGS_TOTEXT) {
|
|||
num = uint16_fromregion(&r);
|
||||
isc_region_consume(&r, 2);
|
||||
RETERR(str_totext(svcparamkey(num, &encoding,
|
||||
buf, sizeof(buf)),
|
||||
buf, sizeof(buf),
|
||||
compat),
|
||||
target));
|
||||
if (r.length != 0) {
|
||||
RETERR(str_totext(",", target));
|
||||
|
|
|
|||
Loading…
Reference in a new issue