[quagga-dev 11832] [PATCH] bgpd: fix negative values in output

Milan Kocian milon at wq.cz
Sat Nov 29 21:57:51 GMT 2014


 Negative value in output of ecommunities (and as numbers)
 seems odd :-). This patch fixes it. And add minor formating
 modification, better for big as numbers.

---
 bgpd/bgp_ecommunity.c |    6 +++---
 bgpd/bgp_vty.c        |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 8a326a8..482e76b 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -688,7 +688,7 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
 	  eas.val = (*pnt++ << 8);
 	  eas.val |= (*pnt++);
 
-	  len = sprintf( str_buf + str_pnt, "%s%u:%d", prefix,
+	  len = sprintf( str_buf + str_pnt, "%s%u:%u", prefix,
                         eas.as, eas.val );
 	  str_pnt += len;
 	  first = 0;
@@ -703,7 +703,7 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
 	  eas.val |= (*pnt++ << 8);
 	  eas.val |= (*pnt++);
 
-	  len = sprintf (str_buf + str_pnt, "%s%u:%d", prefix,
+	  len = sprintf (str_buf + str_pnt, "%s%u:%u", prefix,
 			 eas.as, eas.val);
 	  str_pnt += len;
 	  first = 0;
@@ -715,7 +715,7 @@ ecommunity_ecom2str (struct ecommunity *ecom, int format)
 	  eip.val = (*pnt++ << 8);
 	  eip.val |= (*pnt++);
 
-	  len = sprintf (str_buf + str_pnt, "%s%s:%d", prefix,
+	  len = sprintf (str_buf + str_pnt, "%s%s:%u", prefix,
 			 inet_ntoa (eip.ip), eip.val);
 	  str_pnt += len;
 	  first = 0;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index ca44774..067f5d0 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -8302,7 +8302,7 @@ bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
 
   vty_out (vty, "4 ");
 
-  vty_out (vty, "%11d ", rsclient->as);
+  vty_out (vty, "%11u ", rsclient->as);
 
   rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
   if ( rmname && strlen (rmname) > 13 )
@@ -8347,7 +8347,7 @@ bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
   int count = 0;
 
   /* Header string for each address family. */
-  static char header[] = "Neighbor        V    AS  Export-Policy  Import-Policy  Up/Down  State";
+  static char header[] = "Neighbor        V         AS  Export-Policy  Import-Policy  Up/Down  State";
 
   for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
     {
-- 
1.7.10.4

-- 
Milan Kocian





More information about the Quagga-dev mailing list