mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
Only initialize goal on active keys
If we initialize goals on all keys, superfluous keys that match the policy all desire to be active. For example, there are six keys available for a policy that needs just two, we only want to set the goal state to OMNIPRESENT on two keys, not six.
This commit is contained in:
@@ -1402,7 +1402,7 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
keystr, keymgr_keyrole(dkey->key),
|
||||
dns_kasp_getname(kasp));
|
||||
|
||||
/* Initialize lifetime and goal, if not set. */
|
||||
/* Initialize lifetime if not set. */
|
||||
uint32_t l;
|
||||
if (dst_key_getnum(dkey->key, DST_NUM_LIFETIME,
|
||||
&l) != ISC_R_SUCCESS) {
|
||||
@@ -1411,14 +1411,6 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
lifetime);
|
||||
}
|
||||
|
||||
dst_key_state_t goal;
|
||||
if (dst_key_getstate(dkey->key, DST_KEY_GOAL,
|
||||
&goal) != ISC_R_SUCCESS) {
|
||||
dst_key_setstate(dkey->key,
|
||||
DST_KEY_GOAL,
|
||||
OMNIPRESENT);
|
||||
}
|
||||
|
||||
if (active_key) {
|
||||
/* We already have an active key that
|
||||
* matches the kasp policy.
|
||||
@@ -1442,6 +1434,19 @@ dns_keymgr_run(const dns_name_t *origin, dns_rdataclass_t rdclass,
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is possibly an active key created
|
||||
* outside dnssec-policy. Initialize goal,
|
||||
* if not set.
|
||||
*/
|
||||
dst_key_state_t goal;
|
||||
if (dst_key_getstate(dkey->key, DST_KEY_GOAL,
|
||||
&goal) != ISC_R_SUCCESS) {
|
||||
dst_key_setstate(dkey->key,
|
||||
DST_KEY_GOAL,
|
||||
OMNIPRESENT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the matched key only if it is active
|
||||
* or desires to be active.
|
||||
|
Reference in New Issue
Block a user