diff options
author | Stephen Worley <sworley@cumulusnetworks.com> | 2019-07-02 07:34:57 +0200 |
---|---|---|
committer | Stephen Worley <sworley@cumulusnetworks.com> | 2019-10-25 17:13:40 +0200 |
commit | 2f00094498ebd5dc65c66c1219e4553e36ec35f6 (patch) | |
tree | 8373ebf1b78cd343565c8ffba3b934dc00a03a90 /lib/nexthop_group.c | |
parent | zebra: Use nexthop/interface vrf, not the routes (diff) | |
download | frr-2f00094498ebd5dc65c66c1219e4553e36ec35f6.tar.xz frr-2f00094498ebd5dc65c66c1219e4553e36ec35f6.zip |
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>
Diffstat (limited to 'lib/nexthop_group.c')
-rw-r--r-- | lib/nexthop_group.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index c9a8f1af5..a79b2741c 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -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; |