[cmaster-next] [PATCH 2/2] bgpd: fix "show ip bgp" column alignment

Donald Sharp sharpd at cumulusnetworks.com
Tue Nov 29 12:47:12 EST 2016


From: Daniel Walton <dwalton at cumulusnetworks.com>

The "Weight" column is off:

BGP table version is 0, local router ID is 10.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, =
multipath,
              i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.1.1.2/32       9.9.9.2                  0          32768 ?
*> 4.1.1.4/32       9.9.9.2                  0          32768 ?
Displayed  2 out of 2 total prefixes

Signed-off-by: Daniel Walton <dwalton at cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd at cumulusnetworks.com>
(cherry picked from commit 65c7395b07e8c592c847d4a1e22fc89ddf448341)
---
 bgpd/bgp_route.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 8520466..23ecefa 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -6254,7 +6254,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
         if (json_paths)
           json_object_int_add(json_path, "med", attr->med);
         else
-	  vty_out (vty, "%10u ", attr->med);
+	  vty_out (vty, "%10u", attr->med);
       else
         if (!json_paths)
 	  vty_out (vty, "          ");
@@ -6264,7 +6264,7 @@ route_vty_out (struct vty *vty, struct prefix *p,
         if (json_paths)
           json_object_int_add(json_path, "localpref", attr->local_pref);
         else
-	  vty_out (vty, "%7u ", attr->local_pref);
+	  vty_out (vty, "%7u", attr->local_pref);
       else
         if (!json_paths)
 	  vty_out (vty, "       ");
@@ -6437,12 +6437,12 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p, struct attr *attr, safi_t
             }
 #endif /* HAVE_IPV6 */
           if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC))
-            vty_out (vty, "%10u ", attr->med);
+            vty_out (vty, "%10u", attr->med);
           else
             vty_out (vty, "          ");
 
           if (attr->flag & ATTR_FLAG_BIT (BGP_ATTR_LOCAL_PREF))
-            vty_out (vty, "%7u ", attr->local_pref);
+            vty_out (vty, "%7u", attr->local_pref);
           else
             vty_out (vty, "       ");
 
-- 
2.5.5





More information about the dev mailing list