diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 60ad8d20e9..7e1f7df533 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -10261,6 +10261,24 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, str, label2vni(&attr->label)); } + /* Output some debug about internal state of the dest flags */ + if (json_paths) { + if (CHECK_FLAG(bn->flags, BGP_NODE_PROCESS_SCHEDULED)) + json_object_boolean_true_add(json_path, "processScheduled"); + if (CHECK_FLAG(bn->flags, BGP_NODE_USER_CLEAR)) + json_object_boolean_true_add(json_path, "userCleared"); + if (CHECK_FLAG(bn->flags, BGP_NODE_LABEL_CHANGED)) + json_object_boolean_true_add(json_path, "labelChanged"); + if (CHECK_FLAG(bn->flags, BGP_NODE_REGISTERED_FOR_LABEL)) + json_object_boolean_true_add(json_path, "registeredForLabel"); + if (CHECK_FLAG(bn->flags, BGP_NODE_SELECT_DEFER)) + json_object_boolean_true_add(json_path, "selectDefered"); + if (CHECK_FLAG(bn->flags, BGP_NODE_FIB_INSTALLED)) + json_object_boolean_true_add(json_path, "fibInstalled"); + if (CHECK_FLAG(bn->flags, BGP_NODE_FIB_INSTALL_PENDING)) + json_object_boolean_true_add(json_path, "fibPending"); + } + /* We've constructed the json object for this path, add it to the json * array of paths */ diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index db5c877759..67745a9653 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -2409,7 +2409,6 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, struct prefix p; enum zapi_route_notify_owner note; uint32_t table_id; - char buf[PREFIX_STRLEN]; afi_t afi; safi_t safi; struct bgp_dest *dest; @@ -2431,9 +2430,6 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, return -1; } - if (BGP_DEBUG(zebra, ZEBRA)) - prefix2str(&p, buf, sizeof(buf)); - /* Find the bgp route node */ dest = bgp_afi_node_lookup(bgp->rib[afi][safi], afi, safi, &p, &bgp->vrf_prd); @@ -2452,7 +2448,7 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, BGP_NODE_FIB_INSTALL_PENDING); SET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); if (BGP_DEBUG(zebra, ZEBRA)) - zlog_debug("route %s : INSTALLED", buf); + zlog_debug("route %pRN : INSTALLED", dest); /* Find the best route */ for (pi = dest->info; pi; pi = pi->next) { /* Process aggregate route */ @@ -2468,8 +2464,8 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, dest, new_select); else { flog_err(EC_BGP_INVALID_ROUTE, - "selected route %s not found", - buf); + "selected route %pRN not found", + dest); return -1; } } @@ -2480,16 +2476,24 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, * route add later */ UNSET_FLAG(dest->flags, BGP_NODE_FIB_INSTALLED); + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route %pRN: Removed from Fib", dest); break; case ZAPI_ROUTE_FAIL_INSTALL: + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route: %pRN Failed to Install into Fib", + dest); /* Error will be logged by zebra module */ break; case ZAPI_ROUTE_BETTER_ADMIN_WON: + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("route: %pRN removed due to better admin won", + dest); /* No action required */ break; case ZAPI_ROUTE_REMOVE_FAIL: - zlog_warn("%s: Route %s failure to remove", - __func__, buf); + zlog_warn("%s: Route %pRN failure to remove", + __func__, dest); break; } return 0; diff --git a/pathd/path_pcep_controller.c b/pathd/path_pcep_controller.c index e467a79a87..255503b459 100644 --- a/pathd/path_pcep_controller.c +++ b/pathd/path_pcep_controller.c @@ -26,6 +26,7 @@ #include "northbound.h" #include "frr_pthread.h" #include "jhash.h" +#include "network.h" #include "pathd/pathd.h" #include "pathd/path_errors.h" @@ -1043,7 +1044,7 @@ void remove_pcc_state(struct ctrl_state *ctrl_state, uint32_t backoff_delay(uint32_t max, uint32_t base, uint32_t retry_count) { uint32_t a = min(max, base * (1 << retry_count)); - uint64_t r = rand(), m = RAND_MAX; + uint64_t r = frr_weak_random(), m = RAND_MAX; uint32_t b = (a / 2) + (r * (a / 2)) / m; return b; } diff --git a/pathd/pathd.c b/pathd/pathd.c index 2e2fa86714..e2c7c95728 100644 --- a/pathd/pathd.c +++ b/pathd/pathd.c @@ -21,6 +21,7 @@ #include "memory.h" #include "log.h" #include "lib_errors.h" +#include "network.h" #include "pathd/pathd.h" #include "pathd/path_memory.h" @@ -480,7 +481,7 @@ struct srte_candidate *srte_candidate_add(struct srte_policy *policy, candidate->preference = preference; candidate->policy = policy; candidate->type = SRTE_CANDIDATE_TYPE_UNDEFINED; - candidate->discriminator = rand(); + candidate->discriminator = frr_weak_random(); lsp->candidate = candidate; candidate->lsp = lsp;