Merge pull request #18709 from donaldsharp/nhe_afi_max
Some checks are pending
build-test / Test ubuntu x86 docker image (push) Blocked by required conditions
build-test / Build the x86 ubuntu 22.04 docker image (push) Waiting to run
build-test / Build the ARM ubuntu 22.04 docker image (push) Waiting to run
build-test / Test ubuntu ARM docker image (push) Blocked by required conditions

zebra: Display nhg's afi as `No Afi`
This commit is contained in:
Donatas Abraitis 2025-04-24 17:51:04 -07:00 committed by GitHub
commit dd42058c16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -66,6 +66,14 @@ static void depends_decrement_free(struct nhg_connected_tree_head *head);
static struct nhg_backup_info * static struct nhg_backup_info *
nhg_backup_copy(const struct nhg_backup_info *orig); nhg_backup_copy(const struct nhg_backup_info *orig);
const char *zebra_nhg_afi2str(struct nhg_hash_entry *nhe)
{
if (nhe->afi == AFI_UNSPEC)
return "No AFI";
return afi2str(nhe->afi);
}
/* Helper function for getting the next allocatable ID */ /* Helper function for getting the next allocatable ID */
static uint32_t nhg_get_next_id(void) static uint32_t nhg_get_next_id(void)
{ {

View file

@ -405,6 +405,8 @@ extern void nexthop_vrf_update(struct route_node *rn, struct route_entry *re, vr
extern int nexthop_active_update(struct route_node *rn, struct route_entry *re, extern int nexthop_active_update(struct route_node *rn, struct route_entry *re,
struct route_entry *old_re); struct route_entry *old_re);
extern const char *zebra_nhg_afi2str(struct nhg_hash_entry *nhe);
#ifdef _FRR_ATTRIBUTE_PRINTFRR #ifdef _FRR_ATTRIBUTE_PRINTFRR
#pragma FRR printfrr_ext "%pNG" (const struct nhg_hash_entry *) #pragma FRR printfrr_ext "%pNG" (const struct nhg_hash_entry *)
#endif #endif

View file

@ -1091,7 +1091,7 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
json_object_string_add(json, "uptime", up_str); json_object_string_add(json, "uptime", up_str);
json_object_string_add(json, "vrf", json_object_string_add(json, "vrf",
vrf_id_to_name(nhe->vrf_id)); vrf_id_to_name(nhe->vrf_id));
json_object_string_add(json, "afi", afi2str(nhe->afi)); json_object_string_add(json, "afi", zebra_nhg_afi2str(nhe));
} else { } else {
vty_out(vty, "ID: %u (%s)\n", nhe->id, vty_out(vty, "ID: %u (%s)\n", nhe->id,
@ -1106,7 +1106,7 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
vty_out(vty, " Uptime: %s\n", up_str); vty_out(vty, " Uptime: %s\n", up_str);
vty_out(vty, " VRF: %s(%s)\n", vrf_id_to_name(nhe->vrf_id), vty_out(vty, " VRF: %s(%s)\n", vrf_id_to_name(nhe->vrf_id),
afi2str(nhe->afi)); zebra_nhg_afi2str(nhe));
} }
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) { if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {