mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
append "0" to IPv6 addresses ending in "::" when printing YAML
such addresses broke some YAML parsers.
This commit is contained in:
parent
5d3a7aadb8
commit
a8baf79e33
5
CHANGES
5
CHANGES
@ -1,3 +1,8 @@
|
|||||||
|
5447. [bug] IPv6 addresses ending in "::" could break YAML
|
||||||
|
parsing. A "0" is now appended to such addresses
|
||||||
|
in YAML output from dig, mdig, delv, and dnstap-read.
|
||||||
|
[GL #1952]
|
||||||
|
|
||||||
5446. [bug] The validator could fail to accept a properly signed
|
5446. [bug] The validator could fail to accept a properly signed
|
||||||
RRset if an unsupported algorithm appeared earlier in
|
RRset if an unsupported algorithm appeared earlier in
|
||||||
the DNSKEY RRset than a supported algorithm. It could
|
the DNSKEY RRset than a supported algorithm. It could
|
||||||
|
@ -28,6 +28,8 @@ b A 10.0.0.2
|
|||||||
b AAAA fd92:7065:b8e:ffff::2
|
b AAAA fd92:7065:b8e:ffff::2
|
||||||
c A 10.0.0.3
|
c A 10.0.0.3
|
||||||
c AAAA fd92:7065:b8e:ffff::3
|
c AAAA fd92:7065:b8e:ffff::3
|
||||||
|
d A 10.0.0.0
|
||||||
|
d AAAA fd92:7065:b8e:ffff::
|
||||||
|
|
||||||
xn--caf-dma A 10.1.2.3
|
xn--caf-dma A 10.1.2.3
|
||||||
|
|
||||||
|
@ -907,6 +907,16 @@ if [ -x "$DIG" ] ; then
|
|||||||
[ "$value" = "ns2.example. IN ANY" ] || ret=1
|
[ "$value" = "ns2.example. IN ANY" ] || ret=1
|
||||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||||
status=$((status+ret))
|
status=$((status+ret))
|
||||||
|
|
||||||
|
n=$((n+1))
|
||||||
|
echo_i "check dig +yaml output of an IPv6 address ending in zeroes ($n)"
|
||||||
|
ret=0
|
||||||
|
dig_with_opts +qr +yaml @10.53.0.3 aaaa d.example > dig.out.test$n 2>&1 || ret=1
|
||||||
|
$PYTHON yamlget.py dig.out.test$n 1 message response_message_data ANSWER_SECTION 0 > yamlget.out.test$n 2>&1 || ret=1
|
||||||
|
read -r value < yamlget.out.test$n
|
||||||
|
[ "$value" = "d.example. 300 IN AAAA fd92:7065:b8e:ffff::0" ] || ret=1
|
||||||
|
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||||
|
status=$((status+ret))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
n=$((n+1))
|
n=$((n+1))
|
||||||
|
@ -151,7 +151,7 @@ static isc_result_t
|
|||||||
str_totext(const char *source, isc_buffer_t *target);
|
str_totext(const char *source, isc_buffer_t *target);
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
inet_totext(int af, isc_region_t *src, isc_buffer_t *target);
|
inet_totext(int af, uint32_t flags, isc_region_t *src, isc_buffer_t *target);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
buffer_empty(isc_buffer_t *source);
|
buffer_empty(isc_buffer_t *source);
|
||||||
@ -1754,7 +1754,7 @@ str_totext(const char *source, isc_buffer_t *target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
inet_totext(int af, isc_region_t *src, isc_buffer_t *target) {
|
inet_totext(int af, uint32_t flags, isc_region_t *src, isc_buffer_t *target) {
|
||||||
char tmpbuf[64];
|
char tmpbuf[64];
|
||||||
|
|
||||||
/* Note - inet_ntop doesn't do size checking on its input. */
|
/* Note - inet_ntop doesn't do size checking on its input. */
|
||||||
@ -1765,6 +1765,22 @@ inet_totext(int af, isc_region_t *src, isc_buffer_t *target) {
|
|||||||
return (ISC_R_NOSPACE);
|
return (ISC_R_NOSPACE);
|
||||||
}
|
}
|
||||||
isc_buffer_putstr(target, tmpbuf);
|
isc_buffer_putstr(target, tmpbuf);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An IPv6 address ending in "::" breaks YAML
|
||||||
|
* parsing, so append 0 in that case.
|
||||||
|
*/
|
||||||
|
if (af == AF_INET6 && (flags & DNS_STYLEFLAG_YAML) != 0) {
|
||||||
|
isc_textregion_t tr;
|
||||||
|
isc_buffer_usedregion(target, (isc_region_t *)&tr);
|
||||||
|
if (tr.base[tr.length - 1] == ':') {
|
||||||
|
if (isc_buffer_availablelength(target) == 0) {
|
||||||
|
return (ISC_R_NOSPACE);
|
||||||
|
}
|
||||||
|
isc_buffer_putmem(target, "0", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,10 +165,10 @@ totext_amtrelay(ARGS_TOTEXT) {
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return (inet_totext(AF_INET, ®ion, target));
|
return (inet_totext(AF_INET, tctx->flags, ®ion, target));
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return (inet_totext(AF_INET6, ®ion, target));
|
return (inet_totext(AF_INET6, tctx->flags, ®ion, target));
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
dns_name_init(&name, NULL);
|
dns_name_init(&name, NULL);
|
||||||
|
@ -174,12 +174,12 @@ totext_ipseckey(ARGS_TOTEXT) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
RETERR(inet_totext(AF_INET, ®ion, target));
|
RETERR(inet_totext(AF_INET, tctx->flags, ®ion, target));
|
||||||
isc_region_consume(®ion, 4);
|
isc_region_consume(®ion, 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
RETERR(inet_totext(AF_INET6, ®ion, target));
|
RETERR(inet_totext(AF_INET6, tctx->flags, ®ion, target));
|
||||||
isc_region_consume(®ion, 16);
|
isc_region_consume(®ion, 16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ totext_l32(ARGS_TOTEXT) {
|
|||||||
|
|
||||||
RETERR(str_totext(" ", target));
|
RETERR(str_totext(" ", target));
|
||||||
|
|
||||||
return (inet_totext(AF_INET, ®ion, target));
|
return (inet_totext(AF_INET, tctx->flags, ®ion, target));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
|
@ -57,7 +57,7 @@ totext_hs_a(ARGS_TOTEXT) {
|
|||||||
UNUSED(tctx);
|
UNUSED(tctx);
|
||||||
|
|
||||||
dns_rdata_toregion(rdata, ®ion);
|
dns_rdata_toregion(rdata, ®ion);
|
||||||
return (inet_totext(AF_INET, ®ion, target));
|
return (inet_totext(AF_INET, tctx->flags, ®ion, target));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
|
@ -126,7 +126,7 @@ totext_in_a6(ARGS_TOTEXT) {
|
|||||||
addr[octets] &= mask;
|
addr[octets] &= mask;
|
||||||
ar.base = addr;
|
ar.base = addr;
|
||||||
ar.length = sizeof(addr);
|
ar.length = sizeof(addr);
|
||||||
RETERR(inet_totext(AF_INET6, &ar, target));
|
RETERR(inet_totext(AF_INET6, tctx->flags, &ar, target));
|
||||||
isc_region_consume(&sr, 16 - octets);
|
isc_region_consume(&sr, 16 - octets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ totext_in_a(ARGS_TOTEXT) {
|
|||||||
UNUSED(tctx);
|
UNUSED(tctx);
|
||||||
|
|
||||||
dns_rdata_toregion(rdata, ®ion);
|
dns_rdata_toregion(rdata, ®ion);
|
||||||
return (inet_totext(AF_INET, ®ion, target));
|
return (inet_totext(AF_INET, tctx->flags, ®ion, target));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
|
@ -75,7 +75,7 @@ totext_in_aaaa(ARGS_TOTEXT) {
|
|||||||
return (str_totext(buf, target));
|
return (str_totext(buf, target));
|
||||||
}
|
}
|
||||||
dns_rdata_toregion(rdata, ®ion);
|
dns_rdata_toregion(rdata, ®ion);
|
||||||
return (inet_totext(AF_INET6, ®ion, target));
|
return (inet_totext(AF_INET6, tctx->flags, ®ion, target));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline isc_result_t
|
static inline isc_result_t
|
||||||
|
@ -154,7 +154,7 @@ totext_in_apl(ARGS_TOTEXT) {
|
|||||||
INSIST(prefix <= 32);
|
INSIST(prefix <= 32);
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
memmove(buf, sr.base, len);
|
memmove(buf, sr.base, len);
|
||||||
RETERR(inet_totext(AF_INET, &ir, target));
|
RETERR(inet_totext(AF_INET, tctx->flags, &ir, target));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
@ -162,7 +162,7 @@ totext_in_apl(ARGS_TOTEXT) {
|
|||||||
INSIST(prefix <= 128);
|
INSIST(prefix <= 128);
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
memmove(buf, sr.base, len);
|
memmove(buf, sr.base, len);
|
||||||
RETERR(inet_totext(AF_INET6, &ir, target));
|
RETERR(inet_totext(AF_INET6, tctx->flags, &ir, target));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -218,7 +218,7 @@ totext_in_wks(ARGS_TOTEXT) {
|
|||||||
REQUIRE(rdata->length >= 5);
|
REQUIRE(rdata->length >= 5);
|
||||||
|
|
||||||
dns_rdata_toregion(rdata, &sr);
|
dns_rdata_toregion(rdata, &sr);
|
||||||
RETERR(inet_totext(AF_INET, &sr, target));
|
RETERR(inet_totext(AF_INET, tctx->flags, &sr, target));
|
||||||
isc_region_consume(&sr, 4);
|
isc_region_consume(&sr, 4);
|
||||||
|
|
||||||
proto = uint8_fromregion(&sr);
|
proto = uint8_fromregion(&sr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user