2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

Merge branch '3880-fix-rpz-assertion-failure-during-failed-reconfiguration' into 'main'

Detach rpzs and catzs from the previous view

Closes #3880

See merge request isc-projects/bind9!7552
This commit is contained in:
Arаm Sаrgsyаn 2023-02-21 09:01:27 +00:00
commit 69b39899d5
4 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,7 @@
6105. [bug] Detach 'rpzs' and 'catzs' from the previous view in
configure_rpz() and configure_catz(), respectively,
just after attaching it to the new view. [GL #3880]
6104. [cleanup] Move libbind9's configuration checking code into
libisccfg alongside the other configuration code.
[GL !7461]

View File

@ -2646,6 +2646,7 @@ configure_rpz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t **maps,
dns_rpz_shutdown_rpzs(view->rpzs);
dns_rpz_detach_rpzs(&view->rpzs);
dns_rpz_attach_rpzs(pview->rpzs, &view->rpzs);
dns_rpz_detach_rpzs(&pview->rpzs);
} else if (old != NULL && pview != NULL) {
++pview->rpzs->rpz_ver;
view->rpzs->rpz_ver = pview->rpzs->rpz_ver;
@ -3179,6 +3180,7 @@ configure_catz(dns_view_t *view, dns_view_t *pview, const cfg_obj_t *config,
if (old != NULL) {
dns_catz_catzs_detach(&view->catzs);
dns_catz_catzs_attach(pview->catzs, &view->catzs);
dns_catz_catzs_detach(&pview->catzs);
dns_catz_prereconfig(view->catzs);
}
@ -6012,9 +6014,6 @@ cleanup:
named_config_get(maps, "catalog-zones", &obj) ==
ISC_R_SUCCESS)
{
if (pview->catzs != NULL) {
dns_catz_catzs_detach(&pview->catzs);
}
/*
* We are swapping the places of the `view` and
* `pview` in the function's parameters list

View File

@ -148,3 +148,13 @@ zone "static-stub-nomatch." {
type static-stub;
server-addresses { 10.53.0.10; };
};
# A faulty dlz configuration to check if named with response policy zones
# survives a certain class of failed configuration attempts (see GL #3880).
# "dlz" is used because the dlz processing code is located in an ideal place in
# the view configuration function for the test to cover the view reverting code.
# The "BAD" comments below are necessary, because they will be removed using
# 'sed' by tests.sh in order to activate the faulty configuration.
#BAD dlz "bad-dlz" {
#BAD database "dlopen bad-dlz.so example.org";
#BAD };

View File

@ -848,6 +848,16 @@ EOF
stop_server --use-rndc --port ${CONTROLPORT} ns3
restart 3 "rebuild-bl-rpz"
t=`expr $t + 1`
echo_i "checking if rpz survives a certain class of failed reconfiguration attempts (${t})"
sed -e "s/^#BAD//" < ns3/named.conf.in > ns3/named.conf.tmp
copy_setports ns3/named.conf.tmp ns3/named.conf
rm ns3/named.conf.tmp
$RNDCCMD $ns3 reconfig > /dev/null 2>&1 && setret "failed"
sleep 1
copy_setports ns3/named.conf.in ns3/named.conf
$RNDCCMD $ns3 reconfig || setret "failed"
t=`expr $t + 1`
echo_i "checking the configured extended DNS error code (EDE) (${t})"
$DIG -p ${PORT} @$ns3 walled.tld2 > dig.out.$t