mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 03:27:25 +00:00
zebra: Add depends/dependents release functions
Add some functions to iterate over the depends/dependents RB tree and remove themselves from the other's RB tree. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
18cf7f15d6
commit
21615102a0
@ -173,6 +173,20 @@ void zebra_nhg_depends_init(struct nhg_hash_entry *nhe)
|
|||||||
nhg_connected_head_init(&nhe->nhg_depends);
|
nhg_connected_head_init(&nhe->nhg_depends);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release this nhe from anything that it depends on */
|
||||||
|
static void zebra_nhg_depends_release(struct nhg_hash_entry *nhe)
|
||||||
|
{
|
||||||
|
if (!zebra_nhg_depends_is_empty(nhe)) {
|
||||||
|
struct nhg_connected *rb_node_dep = NULL;
|
||||||
|
struct nhg_connected *tmp = NULL;
|
||||||
|
|
||||||
|
RB_FOREACH_SAFE (rb_node_dep, nhg_connected_head,
|
||||||
|
&nhe->nhg_depends, tmp) {
|
||||||
|
zebra_nhg_dependents_del(rb_node_dep->nhe, nhe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int zebra_nhg_dependents_count(const struct nhg_hash_entry *nhe)
|
unsigned int zebra_nhg_dependents_count(const struct nhg_hash_entry *nhe)
|
||||||
{
|
{
|
||||||
return nhg_connected_head_count(&nhe->nhg_dependents);
|
return nhg_connected_head_count(&nhe->nhg_dependents);
|
||||||
@ -217,6 +231,20 @@ void zebra_nhg_dependents_init(struct nhg_hash_entry *nhe)
|
|||||||
nhg_connected_head_init(&nhe->nhg_dependents);
|
nhg_connected_head_init(&nhe->nhg_dependents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release this nhe from anything depending on it */
|
||||||
|
static void zebra_nhg_dependents_release(struct nhg_hash_entry *nhe)
|
||||||
|
{
|
||||||
|
if (!zebra_nhg_dependents_is_empty(nhe)) {
|
||||||
|
struct nhg_connected *rb_node_dep = NULL;
|
||||||
|
struct nhg_connected *tmp = NULL;
|
||||||
|
|
||||||
|
RB_FOREACH_SAFE (rb_node_dep, nhg_connected_head,
|
||||||
|
&nhe->nhg_dependents, tmp) {
|
||||||
|
zebra_nhg_depends_del(rb_node_dep->nhe, nhe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zebra_nhg_lookup_id() - Lookup the nexthop group id in the id table
|
* zebra_nhg_lookup_id() - Lookup the nexthop group id in the id table
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user