Skip to content

Commit

Permalink
pbrd: add nexthop-vrf to config output
Browse files Browse the repository at this point in the history
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
  • Loading branch information
dslicenc authored and donaldsharp committed Feb 22, 2018
1 parent 342c1ca commit c2a41c6
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions lib/nexthop_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,44 +295,52 @@ static int nexthop_group_write(struct vty *vty)
{
struct nexthop_group_cmd *nhgc;
struct nexthop *nh;
struct vrf *vrf;

RB_FOREACH (nhgc, nhgc_entry_head, &nhgc_entries) {
char buf[100];

vty_out(vty, "nexthop-group %s\n", nhgc->name);

for (nh = nhgc->nhg.nexthop ; nh ; nh = nh->next) {

vty_out(vty, " nexthop ");

switch (nh->type) {
case NEXTHOP_TYPE_IFINDEX:
vty_out(vty, "%s\n",
vty_out(vty, "%s",
ifindex2ifname(nh->ifindex,
nh->vrf_id));
break;
case NEXTHOP_TYPE_IPV4:
vty_out(vty, "%s\n", inet_ntoa(nh->gate.ipv4));
vty_out(vty, "%s", inet_ntoa(nh->gate.ipv4));
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
vty_out(vty, "%s %s\n",
inet_ntoa(nh->gate.ipv4),
vty_out(vty, "%s %s", inet_ntoa(nh->gate.ipv4),
ifindex2ifname(nh->ifindex,
nh->vrf_id));
break;
case NEXTHOP_TYPE_IPV6:
vty_out(vty, "%s\n",
inet_ntop(AF_INET6, &nh->gate.ipv6,
buf, sizeof buf));
vty_out(vty, "%s",
inet_ntop(AF_INET6, &nh->gate.ipv6, buf,
sizeof(buf)));
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
vty_out(vty, "%s %s\n",
inet_ntop(AF_INET6, &nh->gate.ipv6,
buf, sizeof buf),
vty_out(vty, "%s %s",
inet_ntop(AF_INET6, &nh->gate.ipv6, buf,
sizeof(buf)),
ifindex2ifname(nh->ifindex,
nh->vrf_id));
break;
case NEXTHOP_TYPE_BLACKHOLE:
break;
}

if (nh->vrf_id) {
vrf = vrf_lookup_by_id(nh->vrf_id);
vty_out(vty, " nexthop-vrf %s", vrf->name);
}
vty_out(vty, "\n");
}
vty_out(vty, "!\n");
}
Expand Down

0 comments on commit c2a41c6

Please sign in to comment.