mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-03 06:32:33 +00:00
lib: Hash on resolved nexthops by default
Include resolved nexthops when hashing a nexthop group but provide an API that allows you to non-recursively hash as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
7f99772169
commit
2f00094498
@ -273,7 +273,7 @@ void copy_nexthops(struct nexthop **tnh, const struct nexthop *nh,
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t nexthop_group_hash(const struct nexthop_group *nhg)
|
||||
uint32_t nexthop_group_hash_no_recurse(const struct nexthop_group *nhg)
|
||||
{
|
||||
struct nexthop *nh;
|
||||
uint32_t key = 0;
|
||||
@ -288,6 +288,17 @@ uint32_t nexthop_group_hash(const struct nexthop_group *nhg)
|
||||
return key;
|
||||
}
|
||||
|
||||
uint32_t nexthop_group_hash(const struct nexthop_group *nhg)
|
||||
{
|
||||
struct nexthop *nh;
|
||||
uint32_t key = 0;
|
||||
|
||||
for (ALL_NEXTHOPS_PTR(nhg, nh))
|
||||
key = jhash_1word(nexthop_hash(nh), key);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static void nhgc_delete_nexthops(struct nexthop_group_cmd *nhgc)
|
||||
{
|
||||
struct nexthop *nexthop;
|
||||
|
@ -48,6 +48,7 @@ void nexthop_group_copy(struct nexthop_group *to,
|
||||
void copy_nexthops(struct nexthop **tnh, const struct nexthop *nh,
|
||||
struct nexthop *rparent);
|
||||
|
||||
uint32_t nexthop_group_hash_no_recurse(const struct nexthop_group *nhg);
|
||||
uint32_t nexthop_group_hash(const struct nexthop_group *nhg);
|
||||
|
||||
/* The following for loop allows to iterate over the nexthop
|
||||
|
Loading…
Reference in New Issue
Block a user