mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
merged filter-aaaa-on-v6 (ATT SoW)
3327. [func] Added 'filter-aaaa-on-v6' option; this is similar to 'filter-aaaa-on-v4' but applies to IPv6 connections. (Use "configure --enable-filter-aaaa" to enable this option.) [RT #27308]
This commit is contained in:
@@ -598,29 +598,12 @@ check_filteraaaa(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
|
||||
const char *viewname, const cfg_obj_t *config,
|
||||
isc_log_t *logctx, isc_mem_t *mctx)
|
||||
{
|
||||
const cfg_obj_t *options, *aclobj, *obj = NULL;
|
||||
const cfg_obj_t *options, *aclobj, *obj;
|
||||
dns_acl_t *acl = NULL;
|
||||
isc_result_t result = ISC_R_SUCCESS, tresult;
|
||||
dns_v4_aaaa_t filter;
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
dns_aaaa_t filter4, filter6;
|
||||
const char *forview = " for view ";
|
||||
|
||||
if (voptions != NULL)
|
||||
cfg_map_get(voptions, "filter-aaaa-on-v4", &obj);
|
||||
if (obj == NULL && config != NULL) {
|
||||
options = NULL;
|
||||
cfg_map_get(config, "options", &options);
|
||||
if (options != NULL)
|
||||
cfg_map_get(options, "filter-aaaa-on-v4", &obj);
|
||||
}
|
||||
|
||||
if (obj == NULL)
|
||||
filter = dns_v4_aaaa_ok; /* default */
|
||||
else if (cfg_obj_isboolean(obj))
|
||||
filter = cfg_obj_asboolean(obj) ? dns_v4_aaaa_filter :
|
||||
dns_v4_aaaa_ok;
|
||||
else
|
||||
filter = dns_v4_aaaa_break_dnssec; /* break-dnssec */
|
||||
|
||||
if (viewname == NULL) {
|
||||
viewname = "";
|
||||
forview = "";
|
||||
@@ -640,25 +623,66 @@ check_filteraaaa(cfg_aclconfctx_t *actx, const cfg_obj_t *voptions,
|
||||
if (aclobj == NULL)
|
||||
return (result);
|
||||
|
||||
tresult = cfg_acl_fromconfig(aclobj, config, logctx,
|
||||
result = cfg_acl_fromconfig(aclobj, config, logctx,
|
||||
actx, mctx, 0, &acl);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto failure;
|
||||
|
||||
if (tresult != ISC_R_SUCCESS) {
|
||||
result = tresult;
|
||||
} else if (filter != dns_v4_aaaa_ok && dns_acl_isnone(acl)) {
|
||||
obj = NULL;
|
||||
if (voptions != NULL)
|
||||
cfg_map_get(voptions, "filter-aaaa-on-v4", &obj);
|
||||
if (obj == NULL && config != NULL) {
|
||||
options = NULL;
|
||||
cfg_map_get(config, "options", &options);
|
||||
if (options != NULL)
|
||||
cfg_map_get(options, "filter-aaaa-on-v4", &obj);
|
||||
}
|
||||
|
||||
if (obj == NULL)
|
||||
filter4 = dns_aaaa_ok; /* default */
|
||||
else if (cfg_obj_isboolean(obj))
|
||||
filter4 = cfg_obj_asboolean(obj) ? dns_aaaa_filter :
|
||||
dns_aaaa_ok;
|
||||
else
|
||||
filter4 = dns_aaaa_break_dnssec; /* break-dnssec */
|
||||
|
||||
obj = NULL;
|
||||
if (voptions != NULL)
|
||||
cfg_map_get(voptions, "filter-aaaa-on-v6", &obj);
|
||||
if (obj == NULL && config != NULL) {
|
||||
options = NULL;
|
||||
cfg_map_get(config, "options", &options);
|
||||
if (options != NULL)
|
||||
cfg_map_get(options, "filter-aaaa-on-v6", &obj);
|
||||
}
|
||||
|
||||
if (obj == NULL)
|
||||
filter6 = dns_aaaa_ok; /* default */
|
||||
else if (cfg_obj_isboolean(obj))
|
||||
filter6 = cfg_obj_asboolean(obj) ? dns_aaaa_filter :
|
||||
dns_aaaa_ok;
|
||||
else
|
||||
filter6 = dns_aaaa_break_dnssec; /* break-dnssec */
|
||||
|
||||
if ((filter4 != dns_aaaa_ok || filter6 != dns_aaaa_ok) &&
|
||||
dns_acl_isnone(acl))
|
||||
{
|
||||
cfg_obj_log(aclobj, logctx, ISC_LOG_WARNING,
|
||||
"both \"filter-aaaa-on-v4 %s;\" and "
|
||||
"\"filter-aaaa\" is 'none;'%s%s",
|
||||
filter == dns_v4_aaaa_break_dnssec ?
|
||||
"break-dnssec" : "yes", forview, viewname);
|
||||
"\"filter-aaaa\" is 'none;' but "
|
||||
"either filter-aaaa-on-v4 or filter-aaaa-on-v6 "
|
||||
"is enabled%s%s", forview, viewname);
|
||||
result = ISC_R_FAILURE;
|
||||
} else if (filter == dns_v4_aaaa_ok && !dns_acl_isnone(acl)) {
|
||||
} else if (filter4 == dns_aaaa_ok && filter6 == dns_aaaa_ok &&
|
||||
!dns_acl_isnone(acl))
|
||||
{
|
||||
cfg_obj_log(aclobj, logctx, ISC_LOG_WARNING,
|
||||
"both \"filter-aaaa-on-v4 no;\" and "
|
||||
"\"filter-aaaa\" is set%s%s", forview, viewname);
|
||||
"\"filter-aaaa\" is set but "
|
||||
"neither filter-aaaa-on-v4 or filter-aaaa-on-v6 "
|
||||
"is enabled%s%s", forview, viewname);
|
||||
result = ISC_R_FAILURE;
|
||||
}
|
||||
|
||||
failure:
|
||||
if (acl != NULL)
|
||||
dns_acl_detach(&acl);
|
||||
|
||||
|
Reference in New Issue
Block a user