]> git.proxmox.com Git - mirror_frr.git/commitdiff
[bgpd] CID #4,#5,#9,#10, simplify aspath_print_vty usage
authorPaul Jakma <paul.jakma@sun.com>
Fri, 12 May 2006 23:48:40 +0000 (23:48 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Fri, 12 May 2006 23:48:40 +0000 (23:48 +0000)
2006-05-12 Paul Jakma <paul.jakma@sun.com>

* bgp_aspath.{c,h}: (aspath_print_vty) take a format string,
  so as to reduce burden on callers, all in bgp_route.c
* bgp_route.c: (route_vty_out{,tmp}) Update to match
  aspath_print_vty, simplifying checks needed to get spacing
  right. CID #4,#5.
  ({damp,flap}_route_vty_out) Ditto, CID #9, #10

bgpd/ChangeLog
bgpd/bgp_aspath.c
bgpd/bgp_aspath.h
bgpd/bgp_route.c

index 80827393b741085e1e7de0e9d874ac9e7afd801a..7f4f3f1a59936ab140a0bb63ecbc973f50e794c6 100644 (file)
@@ -2,10 +2,15 @@
 
        * bgp_attr.c: (bgp_packet_attribute) Remove dead code, Coverity
          CID #1
+       * bgp_aspath.{c,h}: (aspath_print_vty) take a format string,
+         so as to reduce burden on callers, all in bgp_route.c
        * bgp_route.c: (bgp_static_update_main) Remove useless NULL
          check, code already assumes bgp_static can not be NULL, 
          fixes CID #7.
          (bgp_static_update_rsclient) ditto, CID #6
+         (route_vty_out{,tmp}) Update to match aspath_print_vty,
+         simplifying checks needed to get spacing right. CID #4,#5.
+         ({damp,flap}_route_vty_out) Ditto, CID #9, #10
 
 2006-05-08 Paul Jakma <paul.jakma@sun.com>
 
index 9fce6e3144c87f8c13f56e72de20e325580f1f6e..d404309c24e09adbfce8d7c0e5b1e975c4c5e061 100644 (file)
@@ -1501,9 +1501,10 @@ aspath_print (struct aspath *as)
 
 /* Printing functions */
 void
-aspath_print_vty (struct vty *vty, struct aspath *as)
+aspath_print_vty (struct vty *vty, const char *format, struct aspath *as)
 {
-  vty_out (vty, "%s", as->str);
+  assert (format);
+  vty_out (vty, format, as->str);
 }
 
 static void
index 7fa7f20ba04befb7b716c8cf6ce28bdc12574b62..bf23e5d6a761a5b72a858cdef96fb2d53c5eb3d8 100644 (file)
@@ -77,7 +77,7 @@ extern void aspath_free (struct aspath *);
 extern struct aspath *aspath_intern (struct aspath *);
 extern void aspath_unintern (struct aspath *);
 extern const char *aspath_print (struct aspath *);
-extern void aspath_print_vty (struct vty *, struct aspath *);
+extern void aspath_print_vty (struct vty *, const char *, struct aspath *);
 extern void aspath_print_all_vty (struct vty *);
 extern unsigned int aspath_key_make (struct aspath *);
 extern int aspath_loop_check (struct aspath *, as_t);
index c86ca5f057c3ac3d186cd22ac82534e13543214d..5623cadc0501087a33710d73ff64a718b12599a5 100644 (file)
@@ -5153,16 +5153,13 @@ route_vty_out (struct vty *vty, struct prefix *p,
 
       vty_out (vty, "%7u ",attr->weight);
     
-    /* Print aspath */
-    if (attr->aspath)
-      aspath_print_vty (vty, attr->aspath);
+      /* Print aspath */
+      if (attr->aspath)
+        aspath_print_vty (vty, "%s ", attr->aspath);
 
-    /* Print origin */
-    if (strlen (attr->aspath->str) == 0)
+      /* Print origin */
       vty_out (vty, "%s", bgp_origin_str[attr->origin]);
-    else
-      vty_out (vty, " %s", bgp_origin_str[attr->origin]);
-  }
+    }
   vty_out (vty, "%s", VTY_NEWLINE);
 }  
 
@@ -5217,16 +5214,13 @@ route_vty_out_tmp (struct vty *vty, struct prefix *p,
 
       vty_out (vty, "%7d ",attr->weight);
     
-    /* Print aspath */
-    if (attr->aspath)
-      aspath_print_vty (vty, attr->aspath);
+      /* Print aspath */
+      if (attr->aspath)
+        aspath_print_vty (vty, "%s ", attr->aspath);
 
-    /* Print origin */
-    if (strlen (attr->aspath->str) == 0)
+      /* Print origin */
       vty_out (vty, "%s", bgp_origin_str[attr->origin]);
-    else
-      vty_out (vty, " %s", bgp_origin_str[attr->origin]);
-  }
+    }
 
   vty_out (vty, "%s", VTY_NEWLINE);
 }  
@@ -5314,13 +5308,10 @@ damp_route_vty_out (struct vty *vty, struct prefix *p,
     {
       /* Print aspath */
       if (attr->aspath)
-       aspath_print_vty (vty, attr->aspath);
+       aspath_print_vty (vty, "%s ", attr->aspath);
 
       /* Print origin */
-      if (strlen (attr->aspath->str) == 0)
-       vty_out (vty, "%s", bgp_origin_str[attr->origin]);
-      else
-       vty_out (vty, " %s", bgp_origin_str[attr->origin]);
+      vty_out (vty, "%s", bgp_origin_str[attr->origin]);
     }
   vty_out (vty, "%s", VTY_NEWLINE);
 }
@@ -5377,13 +5368,10 @@ flap_route_vty_out (struct vty *vty, struct prefix *p,
     {
       /* Print aspath */
       if (attr->aspath)
-       aspath_print_vty (vty, attr->aspath);
+       aspath_print_vty (vty, "%s ", attr->aspath);
 
       /* Print origin */
-      if (strlen (attr->aspath->str) == 0)
-       vty_out (vty, "%s", bgp_origin_str[attr->origin]);
-      else
-       vty_out (vty, " %s", bgp_origin_str[attr->origin]);
+      vty_out (vty, "%s", bgp_origin_str[attr->origin]);
     }
   vty_out (vty, "%s", VTY_NEWLINE);
 }
@@ -5408,7 +5396,7 @@ route_vty_out_detail (struct vty *vty, struct bgp *bgp, struct prefix *p,
          if (aspath_count_hops (attr->aspath) == 0)
            vty_out (vty, "Local");
          else
-           aspath_print_vty (vty, attr->aspath);
+           aspath_print_vty (vty, "%s", attr->aspath);
        }
 
       if (CHECK_FLAG (binfo->flags, BGP_INFO_REMOVED))