diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-05 21:56:44 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-01-06 14:57:58 +0200 |
| commit | f8aa53be30010c5fced2ec6c900fa4b8a0bb92dc (patch) | |
| tree | 3cfbcae26a8df1428e1fa63df04c5aec9e374771 | |
| parent | 8ca4c3d0988c169ed41557727f45b69c8ce3aa0b (diff) | |
bgpd: Show ifindex for every BGP nexthop cache entry
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
| -rw-r--r-- | bgpd/bgp_nexthop.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 5fda5701f3..140e1baef7 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -869,6 +869,9 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, ? bnc->ifindex_ipv6_ll : nexthop->ifindex, bgp->vrf_id)); + json_object_int_add(json_gate, "ifindex", + bnc->ifindex_ipv6_ll ? bnc->ifindex_ipv6_ll + : nexthop->ifindex); break; case NEXTHOP_TYPE_IPV4: json_object_string_addf(json_gate, "ip", "%pI4", @@ -882,6 +885,9 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, ? bnc->ifindex_ipv6_ll : nexthop->ifindex, bgp->vrf_id)); + json_object_int_add(json_gate, "ifindex", + bnc->ifindex_ipv6_ll ? bnc->ifindex_ipv6_ll + : nexthop->ifindex); break; case NEXTHOP_TYPE_IPV4_IFINDEX: json_object_string_addf(json_gate, "ip", "%pI4", @@ -893,6 +899,9 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, ? bnc->ifindex_ipv6_ll : nexthop->ifindex, bgp->vrf_id)); + json_object_int_add(json_gate, "ifindex", + bnc->ifindex_ipv6_ll ? bnc->ifindex_ipv6_ll + : nexthop->ifindex); break; case NEXTHOP_TYPE_BLACKHOLE: json_object_boolean_true_add(json_gate, @@ -926,13 +935,13 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, vty_out(vty, " gate %pI6", &nexthop->gate.ipv6); if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX && bnc->ifindex_ipv6_ll) - vty_out(vty, ", if %s\n", - ifindex2ifname(bnc->ifindex_ipv6_ll, - bgp->vrf_id)); + vty_out(vty, ", if %s, ifindex %d\n", + ifindex2ifname(bnc->ifindex_ipv6_ll, bgp->vrf_id), + bnc->ifindex_ipv6_ll); else if (nexthop->ifindex) - vty_out(vty, ", if %s\n", - ifindex2ifname(nexthop->ifindex, - bgp->vrf_id)); + vty_out(vty, ", if %s, ifindex %d\n", + ifindex2ifname(nexthop->ifindex, bgp->vrf_id), + nexthop->ifindex); else vty_out(vty, "\n"); break; @@ -941,22 +950,22 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp, vty_out(vty, " gate %pI4", &nexthop->gate.ipv4); if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX && bnc->ifindex_ipv6_ll) - vty_out(vty, ", if %s\n", - ifindex2ifname(bnc->ifindex_ipv6_ll, - bgp->vrf_id)); + vty_out(vty, ", if %s, ifindex %d\n", + ifindex2ifname(bnc->ifindex_ipv6_ll, bgp->vrf_id), + bnc->ifindex_ipv6_ll); else if (nexthop->ifindex) - vty_out(vty, ", if %s\n", - ifindex2ifname(nexthop->ifindex, - bgp->vrf_id)); + vty_out(vty, ", if %s, ifindex %d\n", + ifindex2ifname(nexthop->ifindex, bgp->vrf_id), + nexthop->ifindex); else vty_out(vty, "\n"); break; case NEXTHOP_TYPE_IFINDEX: - vty_out(vty, " if %s\n", - ifindex2ifname(bnc->ifindex_ipv6_ll - ? bnc->ifindex_ipv6_ll - : nexthop->ifindex, - bgp->vrf_id)); + vty_out(vty, " if %s, ifindex %d\n", + ifindex2ifname(bnc->ifindex_ipv6_ll ? bnc->ifindex_ipv6_ll + : nexthop->ifindex, + bgp->vrf_id), + bnc->ifindex_ipv6_ll ? bnc->ifindex_ipv6_ll : nexthop->ifindex); break; case NEXTHOP_TYPE_BLACKHOLE: vty_out(vty, " blackhole\n"); |
