]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: When displaying nexthop information show correct vrf
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 8 Jan 2018 15:43:07 +0000 (10:43 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 12 Jan 2018 14:20:36 +0000 (09:20 -0500)
If the vrf for the nexthop is different than the vrf the
route is in, display the nexthops vrf.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_vty.c

index a0d2930c89aed46f15d30888d882e8372a166e27..c56df8205364dbe22fe6da3e1f409f5a9ef1d850 100644 (file)
@@ -576,6 +576,14 @@ static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,
                        default:
                                break;
                        }
+
+                       if (re->vrf_id != re->nh_vrf_id) {
+                               struct vrf *vrf =
+                                       vrf_lookup_by_id(re->nh_vrf_id);
+
+                               vty_out(vty, "(vrf %s)", vrf->name);
+                       }
+
                        if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
                                vty_out(vty, " (duplicate nexthop removed)");
 
@@ -774,6 +782,14 @@ 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);
+
+                               json_object_string_add(json_nexthop,
+                                                      "vrf",
+                                                      vrf->name);
+                       }
                        if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_DUPLICATE))
                                json_object_boolean_true_add(json_nexthop,
                                                             "duplicate");
@@ -918,6 +934,14 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
                default:
                        break;
                }
+
+               if (re->nh_vrf_id != re->vrf_id) {
+                       struct vrf *vrf =
+                               vrf_lookup_by_id(re->nh_vrf_id);
+
+                       vty_out(vty, "(vrf %s)", vrf->name);
+               }
+
                if (!CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE))
                        vty_out(vty, " inactive");