diff options
| author | Anuradha Karuppiah <anuradhak@cumulusnetworks.com> | 2019-01-14 15:56:30 -0800 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-03-15 09:38:04 -0400 | 
| commit | 781fca8e6496b7e6c44ee4e1a36e3b2a546b913f (patch) | |
| tree | 2e9eaa59645956e82e1dd7af327e4fd7d2e7003a | |
| parent | 9a0be4f7cdb0e67ae32d077d724dcf53ba7e0b15 (diff) | |
zebra: display metric for connected routes
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>
| -rw-r--r-- | zebra/zebra_vty.c | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index f787d641b4..2672c7b8a7 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -398,11 +398,9 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn,  		if (CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED))  			json_object_boolean_true_add(json_route, "selected"); -		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); @@ -611,7 +609,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 {  | 
