summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zebra/zebra_nhg.c14
-rw-r--r--zebra/zebra_nhg.h10
-rw-r--r--zebra/zebra_rib.c5
-rw-r--r--zebra/zebra_vty.c18
4 files changed, 16 insertions, 31 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c
index 1839133310..172212c652 100644
--- a/zebra/zebra_nhg.c
+++ b/zebra/zebra_nhg.c
@@ -45,7 +45,6 @@ static void *zebra_nhg_alloc(void *arg)
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;
@@ -68,6 +67,7 @@ static uint32_t zebra_nhg_hash_key_nexthop_group(struct nexthop_group *nhg)
* 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);
@@ -97,7 +97,7 @@ uint32_t zebra_nhg_hash_key(const void *arg)
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);
}
@@ -127,9 +127,6 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2)
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
@@ -183,25 +180,22 @@ void zebra_nhg_find_id(uint32_t id, struct nexthop_group *nhg)
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);
diff --git a/zebra/zebra_nhg.h b/zebra/zebra_nhg.h
index e93b579560..227e87256d 100644
--- a/zebra/zebra_nhg.h
+++ b/zebra/zebra_nhg.h
@@ -26,11 +26,8 @@
#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;
@@ -63,8 +60,9 @@ extern uint32_t zebra_nhg_id_key(const void *arg);
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
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index d3c6f5ba11..c8684c1a93 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2411,8 +2411,7 @@ void rib_unlink(struct route_node *rn, struct route_entry *re)
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);
@@ -2659,7 +2658,7 @@ int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *p,
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);
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 32375e0a00..b0b888381c 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1103,7 +1103,7 @@ DEFUN (ip_nht_default_route,
}
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;
@@ -1112,15 +1112,12 @@ static void show_nexthop_group_cmd_helper(struct vty *vty,
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);
@@ -1135,14 +1132,11 @@ static void show_nexthop_group_cmd_helper(struct vty *vty,
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) {
@@ -1156,7 +1150,7 @@ DEFPY (show_nexthop_group,
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;
@@ -1172,7 +1166,7 @@ DEFPY (show_nexthop_group,
return CMD_SUCCESS;
}
- show_nexthop_group_cmd_helper(vty, zvrf, afi);
+ show_nexthop_group_cmd_helper(vty, zvrf);
return CMD_SUCCESS;
}