mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
zebra: include backup nexthops in nhe/nhg show output
Include backup nexthops (if any) in the output of 'show nexthop-group xxx'. Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
parent
0328a5bd0d
commit
eeafa8cd43
@ -1024,51 +1024,13 @@ DEFUN (ip_nht_default_route,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe)
|
/*
|
||||||
|
* Helper that prints out a nexthop in an nhe/nhg
|
||||||
|
*/
|
||||||
|
static void show_nhg_nh_helper(struct vty *vty, const struct nexthop *nexthop)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop = NULL;
|
|
||||||
struct nhg_connected *rb_node_dep = NULL;
|
|
||||||
char buf[SRCDEST2STR_BUFFER];
|
char buf[SRCDEST2STR_BUFFER];
|
||||||
|
|
||||||
struct vrf *nhe_vrf = vrf_lookup_by_id(nhe->vrf_id);
|
|
||||||
|
|
||||||
vty_out(vty, "ID: %u\n", nhe->id);
|
|
||||||
vty_out(vty, " RefCnt: %d\n", nhe->refcnt);
|
|
||||||
|
|
||||||
if (nhe_vrf)
|
|
||||||
vty_out(vty, " VRF: %s AFI: %s\n", nhe_vrf->name,
|
|
||||||
afi2str(nhe->afi));
|
|
||||||
else
|
|
||||||
vty_out(vty, " VRF: UNKNOWN AFI: %s\n",
|
|
||||||
afi2str(nhe->afi));
|
|
||||||
|
|
||||||
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE))
|
|
||||||
vty_out(vty, " Duplicate - from kernel not hashable\n");
|
|
||||||
|
|
||||||
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {
|
|
||||||
vty_out(vty, " Valid");
|
|
||||||
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED))
|
|
||||||
vty_out(vty, ", Installed");
|
|
||||||
vty_out(vty, "\n");
|
|
||||||
}
|
|
||||||
if (nhe->ifp)
|
|
||||||
vty_out(vty, " Interface Index: %d\n", nhe->ifp->ifindex);
|
|
||||||
|
|
||||||
if (!zebra_nhg_depends_is_empty(nhe)) {
|
|
||||||
vty_out(vty, " Depends:");
|
|
||||||
frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
|
|
||||||
vty_out(vty, " (%u)", rb_node_dep->nhe->id);
|
|
||||||
}
|
|
||||||
vty_out(vty, "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ALL_NEXTHOPS(nhe->nhg, nexthop)) {
|
|
||||||
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
|
||||||
vty_out(vty, " ");
|
|
||||||
else
|
|
||||||
/* Make recursive nexthops a bit more clear */
|
|
||||||
vty_out(vty, " ");
|
|
||||||
|
|
||||||
switch (nexthop->type) {
|
switch (nexthop->type) {
|
||||||
case NEXTHOP_TYPE_IPV4:
|
case NEXTHOP_TYPE_IPV4:
|
||||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||||
@ -1163,6 +1125,71 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe)
|
|||||||
vty_out(vty, ", weight %u", nexthop->weight);
|
vty_out(vty, ", weight %u", nexthop->weight);
|
||||||
|
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe)
|
||||||
|
{
|
||||||
|
struct nexthop *nexthop = NULL;
|
||||||
|
struct nhg_connected *rb_node_dep = NULL;
|
||||||
|
struct vrf *nhe_vrf = vrf_lookup_by_id(nhe->vrf_id);
|
||||||
|
struct nexthop_group *backup_nhg;
|
||||||
|
|
||||||
|
vty_out(vty, "ID: %u\n", nhe->id);
|
||||||
|
vty_out(vty, " RefCnt: %d\n", nhe->refcnt);
|
||||||
|
|
||||||
|
if (nhe_vrf)
|
||||||
|
vty_out(vty, " VRF: %s AFI: %s\n", nhe_vrf->name,
|
||||||
|
afi2str(nhe->afi));
|
||||||
|
else
|
||||||
|
vty_out(vty, " VRF: UNKNOWN AFI: %s\n",
|
||||||
|
afi2str(nhe->afi));
|
||||||
|
|
||||||
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_UNHASHABLE))
|
||||||
|
vty_out(vty, " Duplicate - from kernel not hashable\n");
|
||||||
|
|
||||||
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)) {
|
||||||
|
vty_out(vty, " Valid");
|
||||||
|
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED))
|
||||||
|
vty_out(vty, ", Installed");
|
||||||
|
vty_out(vty, "\n");
|
||||||
|
}
|
||||||
|
if (nhe->ifp)
|
||||||
|
vty_out(vty, " Interface Index: %d\n", nhe->ifp->ifindex);
|
||||||
|
|
||||||
|
if (!zebra_nhg_depends_is_empty(nhe)) {
|
||||||
|
vty_out(vty, " Depends:");
|
||||||
|
frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {
|
||||||
|
vty_out(vty, " (%u)", rb_node_dep->nhe->id);
|
||||||
|
}
|
||||||
|
vty_out(vty, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output nexthops */
|
||||||
|
for (ALL_NEXTHOPS(nhe->nhg, nexthop)) {
|
||||||
|
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
||||||
|
vty_out(vty, " ");
|
||||||
|
else
|
||||||
|
/* Make recursive nexthops a bit more clear */
|
||||||
|
vty_out(vty, " ");
|
||||||
|
|
||||||
|
show_nhg_nh_helper(vty, nexthop);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output backup nexthops (if any) */
|
||||||
|
backup_nhg = zebra_nhg_get_backup_nhg(nhe);
|
||||||
|
if (backup_nhg) {
|
||||||
|
vty_out(vty, " Backups:\n");
|
||||||
|
|
||||||
|
for (ALL_NEXTHOPS_PTR(backup_nhg, nexthop)) {
|
||||||
|
if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
|
||||||
|
vty_out(vty, " ");
|
||||||
|
else
|
||||||
|
/* Make recursive nexthops a bit more clear */
|
||||||
|
vty_out(vty, " ");
|
||||||
|
|
||||||
|
show_nhg_nh_helper(vty, nexthop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zebra_nhg_dependents_is_empty(nhe)) {
|
if (!zebra_nhg_dependents_is_empty(nhe)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user