From 34d8aff15b62138288903f6d37d3e2d5231f2040 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 5 May 2022 11:21:20 -0400 Subject: [PATCH] bgpd: Add a bit of debug to give us data about how an update group is formed The creation of the update group is a tiny bit of a black box and is hard to figure out by hand if it is correct. Add a bit of code so that FRR operators/developers can determine if the update group categorization makes us happy. Signed-off-by: Donald Sharp --- bgpd/bgp_updgrp.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index fb3f9aae43..c5d049f363 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -398,7 +398,6 @@ static unsigned int updgrp_hash_key_make(const void *p) key = jhash_1word( (peer->shared_network && peer_afi_active_nego(peer, AFI_IP6)), key); - /* * There are certain peers that must get their own update-group: * - lonesoul peers @@ -413,6 +412,59 @@ static unsigned int updgrp_hash_key_make(const void *p) key = jhash_1word(jhash(peer->host, strlen(peer->host), SEED2), key); + if (bgp_debug_neighbor_events(peer)) { + zlog_debug( + "%pBP Update Group Hash: sort: %d UpdGrpFlags: %u UpdGrpAFFlags: %u", + peer, peer->sort, peer->flags & PEER_UPDGRP_FLAGS, + flags & PEER_UPDGRP_AF_FLAGS); + zlog_debug( + "%pBP Update Group Hash: addpath: %u UpdGrpCapFlag: %u UpdGrpCapAFFlag: %u route_adv: %u change local as: %u", + peer, (uint32_t)peer->addpath_type[afi][safi], + peer->cap & PEER_UPDGRP_CAP_FLAGS, + peer->af_cap[afi][safi] & PEER_UPDGRP_AF_CAP_FLAGS, + peer->v_routeadv, peer->change_local_as); + zlog_debug( + "%pBP Update Group Hash: max packet size: %u pmax_out: %u Peer Group: %s rmap out: %s", + peer, peer->max_packet_size, peer->pmax_out[afi][safi], + peer->group ? peer->group->name : "(NONE)", + ROUTE_MAP_OUT_NAME(filter) ? ROUTE_MAP_OUT_NAME(filter) + : "(NONE)"); + zlog_debug( + "%pBP Update Group Hash: dlist out: %s plist out: %s aslist out: %s usmap out: %s advmap: %s", + peer, + DISTRIBUTE_OUT_NAME(filter) + ? DISTRIBUTE_OUT_NAME(filter) + : "(NONE)", + PREFIX_LIST_OUT_NAME(filter) + ? PREFIX_LIST_OUT_NAME(filter) + : "(NONE)", + FILTER_LIST_OUT_NAME(filter) + ? FILTER_LIST_OUT_NAME(filter) + : "(NONE)", + UNSUPPRESS_MAP_NAME(filter) + ? UNSUPPRESS_MAP_NAME(filter) + : "(NONE)", + ADVERTISE_MAP_NAME(filter) ? ADVERTISE_MAP_NAME(filter) + : "(NONE)"); + zlog_debug( + "%pBP Update Group Hash: default rmap: %s shared network and afi active network: %d", + peer, + peer->default_rmap[afi][safi].name + ? peer->default_rmap[afi][safi].name + : "(NONE)", + peer->shared_network && + peer_afi_active_nego(peer, AFI_IP6)); + zlog_debug( + "%pBP Update Group Hash: Lonesoul: %u ORF prefix: %u ORF old: %u max prefix out: %u", + peer, CHECK_FLAG(peer->flags, PEER_FLAG_LONESOUL), + CHECK_FLAG(peer->af_cap[afi][safi], + PEER_CAP_ORF_PREFIX_SM_RCV), + CHECK_FLAG(peer->af_cap[afi][safi], + PEER_CAP_ORF_PREFIX_SM_OLD_RCV), + CHECK_FLAG(peer->af_flags[afi][safi], + PEER_FLAG_MAX_PREFIX_OUT)); + zlog_debug("%pBP Update Group Hash key: %u", peer, key); + } return key; } -- 2.39.5