Merge branch '3210-dns64-errors' into 'main'

More explicit dns64 prefix errors

Closes #3210

See merge request isc-projects/bind9!5985
This commit is contained in:
Ondřej Surý 2022-03-25 10:38:59 +00:00
commit 745d9db746
2 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,7 @@
5836. [bug] Quote the dns64 prefix in error messages that complain
about problems with it, to avoid confusion with the
following dns64 ACLs. [GL #3210]
5835. [cleanup] Remove extrahandlesize from the netmgr, the callers
now have to allocate the object before calling
isc_nm_setdata() and deallocate the memory in the close

View file

@ -544,7 +544,14 @@ check_viewacls(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
return (result);
}
static const unsigned char zeros[16];
static void
dns64_error(const cfg_obj_t *obj, isc_log_t *logctx, isc_netaddr_t *netaddr,
unsigned int prefixlen, const char *message) {
char buf[ISC_NETADDR_FORMATSIZE + 1];
isc_netaddr_format(netaddr, buf, sizeof(buf));
cfg_obj_log(obj, logctx, ISC_LOG_ERROR, "dns64 prefix %s/%u %s", buf,
prefixlen, message);
}
static isc_result_t
check_dns64(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
@ -583,16 +590,15 @@ check_dns64(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
cfg_obj_asnetprefix(obj, &na, &prefixlen);
if (na.family != AF_INET6) {
cfg_obj_log(map, logctx, ISC_LOG_ERROR,
"dns64 requires a IPv6 prefix");
dns64_error(map, logctx, &na, prefixlen,
"must be IPv6");
result = ISC_R_FAILURE;
continue;
}
if (na.type.in6.s6_addr[8] != 0) {
cfg_obj_log(map, logctx, ISC_LOG_ERROR,
"invalid prefix, bits [64..71] must be "
"zero");
dns64_error(map, logctx, &na, prefixlen,
"bits [64..71] must be zero");
result = ISC_R_FAILURE;
continue;
}
@ -600,9 +606,8 @@ check_dns64(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
if (prefixlen != 32 && prefixlen != 40 && prefixlen != 48 &&
prefixlen != 56 && prefixlen != 64 && prefixlen != 96)
{
cfg_obj_log(map, logctx, ISC_LOG_ERROR,
"bad prefix length %u [32/40/48/56/64/96]",
prefixlen);
dns64_error(map, logctx, &na, prefixlen,
"length is not 32/40/48/56/64/96");
result = ISC_R_FAILURE;
continue;
}
@ -629,6 +634,7 @@ check_dns64(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
obj = NULL;
(void)cfg_map_get(map, "suffix", &obj);
if (obj != NULL) {
static const unsigned char zeros[16];
isc_netaddr_fromsockaddr(&sa, cfg_obj_assockaddr(obj));
if (sa.family != AF_INET6) {
cfg_obj_log(map, logctx, ISC_LOG_ERROR,