Skip to content
Permalink
Browse files

Merge pull request #3569 from donaldsharp/recursive_nexthops

Small cleanup of zebra_rnh.c code
  • Loading branch information...
mjstapp committed Jan 8, 2019
2 parents 91c5235 + 10b6a3e commit 491ad04568e0db53e81f418453e9515c84fb5ba9
Showing with 8 additions and 9 deletions.
  1. +8 −8 zebra/zebra_rnh.c
  2. +0 −1 zebra/zebra_rnh.h
@@ -178,11 +178,15 @@ void zebra_free_rnh(struct rnh *rnh)
XFREE(MTYPE_RNH, rnh);
}

void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type)
static void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type)
{
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;

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);
}
listnode_delete(rnh->client_list, client);
if (list_isempty(rnh->client_list)
&& list_isempty(rnh->zebra_pseudowire_list))
zebra_delete_rnh(rnh, type);
zebra_delete_rnh(rnh, type);
}

/* 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);
pw->rnh = NULL;

if (list_isempty(rnh->client_list)
&& list_isempty(rnh->zebra_pseudowire_list))
zebra_delete_rnh(rnh, RNH_NEXTHOP_TYPE);
zebra_delete_rnh(rnh, RNH_NEXTHOP_TYPE);
}

/* Apply the NHT route-map for a client to the route (and nexthops)
@@ -72,7 +72,6 @@ extern struct rnh *zebra_add_rnh(struct prefix *p, vrf_id_t vrfid,
extern struct rnh *zebra_lookup_rnh(struct prefix *p, vrf_id_t vrfid,
rnh_type_t type);
extern void zebra_free_rnh(struct rnh *rnh);
extern void zebra_delete_rnh(struct rnh *rnh, rnh_type_t type);
extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client,
rnh_type_t type, vrf_id_t vrfid);
extern void zebra_register_rnh_pseudowire(vrf_id_t, struct zebra_pw *);

0 comments on commit 491ad04

Please sign in to comment.
You can’t perform that action at this time.