]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: display metric for connected routes
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Mon, 14 Jan 2019 23:56:30 +0000 (15:56 -0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 27 Mar 2019 12:55:58 +0000 (08:55 -0400)
In a VRR/VRRP setup we can have connected routes with different costs.
So this change eliminates suppressing metric display for connected routes.

Sample output -
root@TORC11:~# vtysh -c "show ipv6 route vrf vrf1"
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
       v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
       > - selected route, * - FIB route

VRF vrf1:
K * ::/0 [255/8192] unreachable (ICMP unreachable), 00:00:36
C * 2001:aa:1::/64 [0/100] is directly connected, vlan1002-v0, 00:00:36
C>* 2001:aa:1::/64 [0/90] is directly connected, vlan1002, 00:00:36

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
zebra/zebra_vty.c

index 6e152a1b1dfcbd7da2394f259ab097b1c4e15464..8bf74d02401dbc2dfa77e01f224884b4be0c446e 100644 (file)
@@ -394,11 +394,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
                        json_object_boolean_true_add(json_route,
                                                     "destSelected");
 
-               if (re->type != ZEBRA_ROUTE_CONNECT) {
-                       json_object_int_add(json_route, "distance",
-                                           re->distance);
-                       json_object_int_add(json_route, "metric", re->metric);
-               }
+               json_object_int_add(json_route, "distance",
+                                   re->distance);
+               json_object_int_add(json_route, "metric", re->metric);
 
                if (re->tag)
                        json_object_int_add(json_route, "tag", re->tag);
@@ -607,7 +605,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,
                                srcdest_rnode2str(rn, buf, sizeof buf));
 
                        /* Distance and metric display. */
-                       if (re->type != ZEBRA_ROUTE_CONNECT)
+                       if (((re->type == ZEBRA_ROUTE_CONNECT) &&
+                            (re->distance || re->metric)) ||
+                           (re->type != ZEBRA_ROUTE_CONNECT))
                                len += vty_out(vty, " [%u/%u]", re->distance,
                                               re->metric);
                } else {