mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
Merge pull request #15401 from idryzhov/fix-nb-crash
Fix order of NB callbacks (and a crash)
This commit is contained in:
commit
37588ece04
@ -94,7 +94,8 @@ const struct frr_yang_module_info frr_affinity_map_info = {
|
|||||||
.cbs = {
|
.cbs = {
|
||||||
.create = lib_affinity_map_create,
|
.create = lib_affinity_map_create,
|
||||||
.destroy = lib_affinity_map_destroy,
|
.destroy = lib_affinity_map_destroy,
|
||||||
}
|
},
|
||||||
|
.priority = NB_DFLT_PRIORITY - 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-affinity-map:lib/affinity-maps/affinity-map/value",
|
.xpath = "/frr-affinity-map:lib/affinity-maps/affinity-map/value",
|
||||||
|
@ -391,11 +391,14 @@ void nb_config_replace(struct nb_config *config_dst,
|
|||||||
static inline int nb_config_cb_compare(const struct nb_config_cb *a,
|
static inline int nb_config_cb_compare(const struct nb_config_cb *a,
|
||||||
const struct nb_config_cb *b)
|
const struct nb_config_cb *b)
|
||||||
{
|
{
|
||||||
/* Sort by priority first. */
|
/*
|
||||||
|
* Sort by priority first. If the operation is "destroy", reverse the
|
||||||
|
* order, so that the dependencies are destroyed before the dependants.
|
||||||
|
*/
|
||||||
if (a->nb_node->priority < b->nb_node->priority)
|
if (a->nb_node->priority < b->nb_node->priority)
|
||||||
return -1;
|
return a->operation != NB_CB_DESTROY ? -1 : 1;
|
||||||
if (a->nb_node->priority > b->nb_node->priority)
|
if (a->nb_node->priority > b->nb_node->priority)
|
||||||
return 1;
|
return a->operation != NB_CB_DESTROY ? 1 : -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Preserve the order of the configuration changes as told by libyang.
|
* Preserve the order of the configuration changes as told by libyang.
|
||||||
|
Loading…
Reference in New Issue
Block a user