mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
zebra: Abstract zebra_delete_rnh
The deletion of a rnh is always proceeded by the same checks to see if it is done. Just let zebra_delete_rnh do this test. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
c05f659a58
commit
8d6848dde2
@ -182,7 +182,11 @@ void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type)
|
|||||||
{
|
{
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
|
|
||||||
if (!rnh || (rnh->flags & ZEBRA_NHT_DELETED) || !(rn = rnh->node))
|
if (!list_isempty(rnh->client_list)
|
||||||
|
|| !list_isempty(rnh->zebra_pseudowire_list))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((rnh->flags & ZEBRA_NHT_DELETED) || !(rn = rnh->node))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_NHT) {
|
if (IS_ZEBRA_DEBUG_NHT) {
|
||||||
@ -233,9 +237,7 @@ void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client,
|
|||||||
rnh_str(rnh, buf, sizeof(buf)), type);
|
rnh_str(rnh, buf, sizeof(buf)), type);
|
||||||
}
|
}
|
||||||
listnode_delete(rnh->client_list, client);
|
listnode_delete(rnh->client_list, client);
|
||||||
if (list_isempty(rnh->client_list)
|
zebra_delete_rnh(rnh, type);
|
||||||
&& list_isempty(rnh->zebra_pseudowire_list))
|
|
||||||
zebra_delete_rnh(rnh, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX move this utility function elsewhere? */
|
/* XXX move this utility function elsewhere? */
|
||||||
@ -291,9 +293,7 @@ void zebra_deregister_rnh_pseudowire(vrf_id_t vrf_id, struct zebra_pw *pw)
|
|||||||
listnode_delete(rnh->zebra_pseudowire_list, pw);
|
listnode_delete(rnh->zebra_pseudowire_list, pw);
|
||||||
pw->rnh = NULL;
|
pw->rnh = NULL;
|
||||||
|
|
||||||
if (list_isempty(rnh->client_list)
|
zebra_delete_rnh(rnh, RNH_NEXTHOP_TYPE);
|
||||||
&& list_isempty(rnh->zebra_pseudowire_list))
|
|
||||||
zebra_delete_rnh(rnh, RNH_NEXTHOP_TYPE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the NHT route-map for a client to the route (and nexthops)
|
/* Apply the NHT route-map for a client to the route (and nexthops)
|
||||||
|
Loading…
Reference in New Issue
Block a user