mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 15:10:38 +00:00
bgpd: Add bgp_nexthop_dump_bnc_flags
Add a function that allows us to see a string version of the bnc->flags bit fields. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
ecf497baed
commit
987a720a11
@ -33,6 +33,7 @@
|
||||
#include "nexthop.h"
|
||||
#include "queue.h"
|
||||
#include "filter.h"
|
||||
#include "printfrr.h"
|
||||
|
||||
#include "bgpd/bgpd.h"
|
||||
#include "bgpd/bgp_route.h"
|
||||
@ -1020,3 +1021,28 @@ void bgp_scan_finish(struct bgp *bgp)
|
||||
bgp->connected_table[afi] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc, char *buf,
|
||||
size_t len)
|
||||
{
|
||||
if (bnc->flags == 0) {
|
||||
snprintfrr(buf, len, "None ");
|
||||
return buf;
|
||||
}
|
||||
|
||||
snprintfrr(buf, len, "%s%s%s%s%s%s%s",
|
||||
CHECK_FLAG(bnc->flags, BGP_NEXTHOP_VALID) ? "Valid " : "",
|
||||
CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED) ? "Reg " : "",
|
||||
CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED) ? "Conn " : "",
|
||||
CHECK_FLAG(bnc->flags, BGP_NEXTHOP_PEER_NOTIFIED) ? "Notify "
|
||||
: "",
|
||||
CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE) ? "Static " : "",
|
||||
CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)
|
||||
? "Static Exact "
|
||||
: "",
|
||||
CHECK_FLAG(bnc->flags, BGP_NEXTHOP_LABELED_VALID)
|
||||
? "Label Valid "
|
||||
: "");
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
@ -100,6 +100,9 @@ struct update_subgroup;
|
||||
struct bgp_dest;
|
||||
struct attr;
|
||||
|
||||
#define BNC_FLAG_DUMP_SIZE 180
|
||||
extern char *bgp_nexthop_dump_bnc_flags(struct bgp_nexthop_cache *bnc,
|
||||
char *buf, size_t len);
|
||||
extern void bgp_connected_add(struct bgp *bgp, struct connected *c);
|
||||
extern void bgp_connected_delete(struct bgp *bgp, struct connected *c);
|
||||
extern bool bgp_subgrp_multiaccess_check_v4(struct in_addr nexthop,
|
||||
|
@ -320,12 +320,17 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
|
||||
bnc->change_flags = 0;
|
||||
|
||||
/* debug print the input */
|
||||
if (BGP_DEBUG(nht, NHT))
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char bnc_buf[BNC_FLAG_DUMP_SIZE];
|
||||
|
||||
zlog_debug(
|
||||
"%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags 0x%x",
|
||||
"%s(%u): Rcvd NH update %pFX(%u) - metric %d/%d #nhops %d/%d flags %s",
|
||||
bnc->bgp->name_pretty, bnc->bgp->vrf_id, &nhr->prefix,
|
||||
bnc->srte_color, nhr->metric, bnc->metric,
|
||||
nhr->nexthop_num, bnc->nexthop_num, bnc->flags);
|
||||
nhr->nexthop_num, bnc->nexthop_num,
|
||||
bgp_nexthop_dump_bnc_flags(bnc, bnc_buf,
|
||||
sizeof(bnc_buf)));
|
||||
}
|
||||
|
||||
if (nhr->metric != bnc->metric)
|
||||
bnc->change_flags |= BGP_NEXTHOP_METRIC_CHANGED;
|
||||
@ -702,10 +707,13 @@ static void evaluate_paths(struct bgp_nexthop_cache *bnc)
|
||||
|
||||
if (BGP_DEBUG(nht, NHT)) {
|
||||
char buf[PREFIX2STR_BUFFER];
|
||||
char bnc_buf[BNC_FLAG_DUMP_SIZE];
|
||||
|
||||
bnc_str(bnc, buf, PREFIX2STR_BUFFER);
|
||||
zlog_debug(
|
||||
"NH update for %s(%u)(%s) - flags 0x%x chgflags 0x%x - evaluate paths",
|
||||
buf, bnc->srte_color, bnc->bgp->name_pretty, bnc->flags,
|
||||
"NH update for %s(%u)(%s) - flags %s chgflags 0x%x - evaluate paths",
|
||||
buf, bnc->srte_color, bnc->bgp->name_pretty,
|
||||
bgp_nexthop_dump_bnc_flags(bnc, bnc_buf, sizeof(bnc_buf)),
|
||||
bnc->change_flags);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user