Merge pull request #13379 from pguibert6WIND/bgp_nht_must_equal_zebra_nht

bgpd: keep interface index on bgp nexthop tracking
This commit is contained in:
Donatas Abraitis 2023-04-28 09:32:24 +03:00 committed by GitHub
commit 0c41d0ffad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -908,17 +908,34 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp,
} }
switch (nexthop->type) { switch (nexthop->type) {
case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6:
vty_out(vty, " gate %pI6\n", &nexthop->gate.ipv6);
break;
case NEXTHOP_TYPE_IPV6_IFINDEX: case NEXTHOP_TYPE_IPV6_IFINDEX:
vty_out(vty, " gate %pI6, if %s\n", vty_out(vty, " gate %pI6", &nexthop->gate.ipv6);
&nexthop->gate.ipv6, if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX &&
ifindex2ifname(bnc->ifindex ? bnc->ifindex bnc->ifindex)
: nexthop->ifindex, vty_out(vty, ", if %s\n",
ifindex2ifname(bnc->ifindex,
bgp->vrf_id)); bgp->vrf_id));
else if (nexthop->ifindex)
vty_out(vty, ", if %s\n",
ifindex2ifname(nexthop->ifindex,
bgp->vrf_id));
else
vty_out(vty, "\n");
break; break;
case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4:
vty_out(vty, " gate %pI4\n", &nexthop->gate.ipv4); case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out(vty, " gate %pI4", &nexthop->gate.ipv4);
if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX &&
bnc->ifindex)
vty_out(vty, ", if %s\n",
ifindex2ifname(bnc->ifindex,
bgp->vrf_id));
else if (nexthop->ifindex)
vty_out(vty, ", if %s\n",
ifindex2ifname(nexthop->ifindex,
bgp->vrf_id));
else
vty_out(vty, "\n");
break; break;
case NEXTHOP_TYPE_IFINDEX: case NEXTHOP_TYPE_IFINDEX:
vty_out(vty, " if %s\n", vty_out(vty, " if %s\n",
@ -926,13 +943,6 @@ static void bgp_show_nexthops_detail(struct vty *vty, struct bgp *bgp,
: nexthop->ifindex, : nexthop->ifindex,
bgp->vrf_id)); bgp->vrf_id));
break; break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out(vty, " gate %pI4, if %s\n",
&nexthop->gate.ipv4,
ifindex2ifname(bnc->ifindex ? bnc->ifindex
: nexthop->ifindex,
bgp->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE: case NEXTHOP_TYPE_BLACKHOLE:
vty_out(vty, " blackhole\n"); vty_out(vty, " blackhole\n");
break; break;