From b2518c1e884cb8b4f4502f8b90b1c368e1a352ec Mon Sep 17 00:00:00 2001 From: Paul Jakma Date: Fri, 12 May 2006 23:48:40 +0000 Subject: [bgpd] CID #4,#5,#9,#10, simplify aspath_print_vty usage 2006-05-12 Paul Jakma * 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/bgp_route.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) (limited to 'bgpd/bgp_route.c') diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index c86ca5f0..5623cadc 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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)) -- cgit v1.2.1