nhe = XMALLOC(MTYPE_TMP, sizeof(struct nhg_hash_entry));
nhe->vrf_id = copy->vrf_id;
- nhe->afi = copy->afi;
nhe->refcnt = 0;
nhe->dplane_ref = zebra_router_get_next_sequence();
nhe->nhg.nexthop = NULL;
* resolved nexthops
*/
for (nh = nhg->nexthop; nh; nh = nh->next) {
+ key = jhash_1word(nh->type, key);
key = jhash_2words(nh->vrf_id, nh->nh_label_type, key);
/* gate and blackhole are together in a union */
key = jhash(&nh->gate, sizeof(nh->gate), key);
const struct nhg_hash_entry *nhe = arg;
int key = 0x5a351234;
- key = jhash_2words(nhe->vrf_id, nhe->afi, key);
+ key = jhash_1word(nhe->vrf_id, key);
return jhash_1word(zebra_nhg_hash_key_nexthop_group(&nhe->nhg), key);
}
if (nhe1->vrf_id != nhe2->vrf_id)
return false;
- if (nhe1->afi != nhe2->afi)
- return false;
-
/*
* Again we are not interested in looking at any recursively
* resolved nexthops. Top level only
zebra_nhg_lookup_get(zrouter.nhgs_id, &lookup);
}
-void zebra_nhg_find(afi_t afi, struct nexthop_group *nhg,
- struct route_entry *re)
+void zebra_nhg_find(struct nexthop_group *nhg, struct route_entry *re)
{
struct nhg_hash_entry lookup;
memset(&lookup, 0, sizeof(lookup));
lookup.vrf_id = re->vrf_id;
- lookup.afi = afi;
lookup.nhg = *nhg;
re->nhe = zebra_nhg_lookup_get(zrouter.nhgs, &lookup);
}
-void zebra_nhg_release(afi_t afi, struct route_entry *re)
+void zebra_nhg_release(struct route_entry *re)
{
struct nhg_hash_entry lookup, *nhe;
lookup.vrf_id = re->vrf_id;
- lookup.afi = afi;
lookup.nhg = *re->ng;
nhe = hash_lookup(zrouter.nhgs, &lookup);
#include "zebra/rib.h"
#include "lib/nexthop_group.h"
-extern int nexthop_active_update(struct route_node *rn, struct route_entry *re);
-
struct nhg_hash_entry {
uint32_t id;
- afi_t afi;
vrf_id_t vrf_id;
struct nexthop_group nhg;
extern bool zebra_nhg_hash_equal(const void *arg1, const void *arg2);
extern bool zebra_nhg_id_equal(const void *arg1, const void *arg2);
-extern void zebra_nhg_find(afi_t afi, struct nexthop_group *nhg,
- struct route_entry *re);
+extern void zebra_nhg_find(struct nexthop_group *nhg, struct route_entry *re);
extern void zebra_nhg_find_id(uint32_t id, struct nexthop_group *nhg);
-void zebra_nhg_release(afi_t afi, struct route_entry *re);
+void zebra_nhg_release(struct route_entry *re);
+
+extern int nexthop_active_update(struct route_node *rn, struct route_entry *re);
#endif
if (dest->selected_fib == re)
dest->selected_fib = NULL;
- info = srcdest_rnode_table_info(rn);
- zebra_nhg_release(info->afi, re);
+ zebra_nhg_release(re);
nexthops_free(re->ng->nexthop);
nexthop_group_delete(&re->ng);
if (src_p)
apply_mask_ipv6(src_p);
- zebra_nhg_find(afi, re->ng, re);
+ zebra_nhg_find(re->ng, re);
/* Set default distance by route type. */
if (re->distance == 0)
re->distance = route_distance(re->type);
}
static void show_nexthop_group_cmd_helper(struct vty *vty,
- struct zebra_vrf *zvrf, afi_t afi)
+ struct zebra_vrf *zvrf)
{
struct list *list = hash_to_list(zrouter.nhgs);
struct nhg_hash_entry *nhe;
for (ALL_LIST_ELEMENTS_RO(list, node, nhe)) {
struct nexthop *nhop;
- if (nhe->afi != afi)
- continue;
-
if (nhe->vrf_id != zvrf->vrf->vrf_id)
continue;
vty_out(vty,
- "Group: %u RefCnt: %u afi: %d Valid: %d Installed: %d\n",
- nhe->dplane_ref, nhe->refcnt, nhe->afi,
+ "Group: %u ID: %u RefCnt: %d Valid: %d Installed: %d\n",
+ nhe->dplane_ref, nhe->id, nhe->refcnt,
nhe->flags & NEXTHOP_GROUP_VALID,
nhe->flags & NEXTHOP_GROUP_INSTALLED);
DEFPY (show_nexthop_group,
show_nexthop_group_cmd,
- "show nexthop-group <ipv4$v4|ipv6$v6> [vrf <NAME$vrf_name|all$vrf_all>]",
+ "show nexthop-group [vrf <NAME$vrf_name|all$vrf_all>]",
SHOW_STR
- IP_STR
- IP6_STR
"Show Nexthop Groups\n"
VRF_FULL_CMD_HELP_STR)
{
- afi_t afi = v4 ? AFI_IP : AFI_IP6;
struct zebra_vrf *zvrf;
if (vrf_all) {
continue;
vty_out(vty, "VRF: %s\n", vrf->name);
- show_nexthop_group_cmd_helper(vty, zvrf, afi);
+ show_nexthop_group_cmd_helper(vty, zvrf);
}
return CMD_SUCCESS;
return CMD_SUCCESS;
}
- show_nexthop_group_cmd_helper(vty, zvrf, afi);
+ show_nexthop_group_cmd_helper(vty, zvrf);
return CMD_SUCCESS;
}