From e02672605b3fbbd4fc2df096c8e47bb41c366da9 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Wed, 20 Oct 2021 16:15:22 +0200 Subject: [PATCH] bgpd: fix calculation of update-group hash with maximum-prefix-out Take into account the maximum-prefix-out value when calculating the update-group hash. Fixes: fde246e8353a ("bgpd: Add an option to limit outgoing prefixes") Signed-off-by: Louis Scalbert --- bgpd/bgp_updgrp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index dd3309dad9..a65be3d128 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -306,6 +306,7 @@ static void *updgrp_hash_alloc(void *p) * 14. encoding both global and link-local nexthop? * 15. If peer is configured to be a lonesoul, peer ip address * 16. Local-as should match, if configured. + * 17. maximum-prefix-out * ) */ static unsigned int updgrp_hash_key_make(const void *p) @@ -340,6 +341,7 @@ static unsigned int updgrp_hash_key_make(const void *p) key = jhash_1word(peer->v_routeadv, key); key = jhash_1word(peer->change_local_as, key); key = jhash_1word(peer->max_packet_size, key); + key = jhash_1word(peer->pmax_out[afi][safi], key); if (peer->group) key = jhash_1word(jhash(peer->group->name, @@ -453,6 +455,9 @@ static bool updgrp_hash_cmp(const void *p1, const void *p2) if (pe1->change_local_as != pe2->change_local_as) return false; + if (pe1->pmax_out[afi][safi] != pe2->pmax_out[afi][safi]) + return false; + /* flags like route reflector client */ if ((flags1 & PEER_UPDGRP_AF_FLAGS) != (flags2 & PEER_UPDGRP_AF_FLAGS)) return false;