From 4a7371e9e21569eee0e728f64ea06870d1aafa5e Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 8 Feb 2018 09:12:12 -0500 Subject: *: Track vrfs per nexthop not per route entry Track the vfrs on a per nexthop basis instead of on a per route entry basis. Signed-off-by: Donald Sharp --- zebra/zebra_vty.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'zebra/zebra_vty.c') diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 93397afa7..3f6db5986 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -770,8 +770,9 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn, inet_ntoa(nexthop->gate.ipv4)); if (nexthop->ifindex) vty_out(vty, ", via %s", - ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + ifindex2ifname( + nexthop->ifindex, + nexthop->vrf_id)); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: @@ -780,13 +781,14 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn, buf, sizeof buf)); if (nexthop->ifindex) vty_out(vty, ", via %s", - ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + ifindex2ifname( + nexthop->ifindex, + nexthop->vrf_id)); break; case NEXTHOP_TYPE_IFINDEX: vty_out(vty, " directly connected, %s", ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + nexthop->vrf_id)); break; case NEXTHOP_TYPE_BLACKHOLE: vty_out(vty, " unreachable"); @@ -809,9 +811,9 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn, break; } - if (re->vrf_id != re->nh_vrf_id) { + if (re->vrf_id != nexthop->vrf_id) { struct vrf *vrf = - vrf_lookup_by_id(re->nh_vrf_id); + vrf_lookup_by_id(nexthop->vrf_id); vty_out(vty, "(vrf %s)", vrf->name); } @@ -954,8 +956,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, nexthop->ifindex); json_object_string_add( json_nexthop, "interfaceName", - ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + ifindex2ifname( + nexthop->ifindex, + nexthop->vrf_id)); } break; case NEXTHOP_TYPE_IPV6: @@ -973,8 +976,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, nexthop->ifindex); json_object_string_add( json_nexthop, "interfaceName", - ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + ifindex2ifname( + nexthop->ifindex, + nexthop->vrf_id)); } break; @@ -987,7 +991,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, json_object_string_add( json_nexthop, "interfaceName", ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + nexthop->vrf_id)); break; case NEXTHOP_TYPE_BLACKHOLE: json_object_boolean_true_add(json_nexthop, @@ -1014,9 +1018,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, break; } - if (re->nh_vrf_id != re->vrf_id) { + if (nexthop->vrf_id != re->vrf_id) { struct vrf *vrf = - vrf_lookup_by_id(re->nh_vrf_id); + vrf_lookup_by_id(nexthop->vrf_id); json_object_string_add(json_nexthop, "vrf", @@ -1129,7 +1133,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, if (nexthop->ifindex) vty_out(vty, ", %s", ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + nexthop->vrf_id)); break; case NEXTHOP_TYPE_IPV6: case NEXTHOP_TYPE_IPV6_IFINDEX: @@ -1139,13 +1143,13 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, if (nexthop->ifindex) vty_out(vty, ", %s", ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + nexthop->vrf_id)); break; case NEXTHOP_TYPE_IFINDEX: vty_out(vty, " is directly connected, %s", ifindex2ifname(nexthop->ifindex, - re->nh_vrf_id)); + nexthop->vrf_id)); break; case NEXTHOP_TYPE_BLACKHOLE: vty_out(vty, " unreachable"); @@ -1167,9 +1171,8 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, break; } - if (re->nh_vrf_id != re->vrf_id) { - struct vrf *vrf = - vrf_lookup_by_id(re->nh_vrf_id); + if (nexthop->vrf_id != re->vrf_id) { + struct vrf *vrf = vrf_lookup_by_id(nexthop->vrf_id); vty_out(vty, "(vrf %s)", vrf->name); } -- cgit v1.2.3