diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 85f09ccf0b..2ae693cd30 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -2122,16 +2122,12 @@ const char *aspath_print(struct aspath *as) } /* Printing functions */ -/* Feed the AS_PATH to the vty; the suffix string follows it only in case +/* Feed the AS_PATH to the vty; the space suffix follows it only in case * AS_PATH wasn't empty. */ -void aspath_print_vty(struct vty *vty, const char *format, struct aspath *as, - const char *suffix) +void aspath_print_vty(struct vty *vty, struct aspath *as) { - assert(format); - vty_out(vty, format, as->str); - if (as->str_len && strlen(suffix)) - vty_out(vty, "%s", suffix); + vty_out(vty, "%s%s", as->str, as->str_len ? " " : ""); } static void aspath_show_all_iterator(struct hash_bucket *bucket, diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h index 97bc7c0aca..a814d73ddd 100644 --- a/bgpd/bgp_aspath.h +++ b/bgpd/bgp_aspath.h @@ -104,8 +104,7 @@ extern void aspath_free(struct aspath *aspath); extern struct aspath *aspath_intern(struct aspath *aspath); extern void aspath_unintern(struct aspath **aspath); extern const char *aspath_print(struct aspath *aspath); -extern void aspath_print_vty(struct vty *vty, const char *format, - struct aspath *aspath, const char *suffix); +extern void aspath_print_vty(struct vty *vty, struct aspath *aspath); extern void aspath_print_all_vty(struct vty *vty); extern unsigned int aspath_key_make(const void *p); extern unsigned int aspath_get_first_as(struct aspath *aspath); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 3f07e53bb6..988a8bad0e 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9483,7 +9483,7 @@ void route_vty_out(struct vty *vty, const struct prefix *p, json_object_string_add(json_path, "path", attr->aspath->str); else - aspath_print_vty(vty, "%s", attr->aspath, " "); + aspath_print_vty(vty, attr->aspath); } /* Print origin */ @@ -9701,7 +9701,7 @@ CPP_NOTICE("Drop `bgpOriginCodes` from JSON outputs") /* Print aspath */ if (attr->aspath) - aspath_print_vty(vty, "%s", attr->aspath, " "); + aspath_print_vty(vty, attr->aspath); /* Print origin */ vty_out(vty, "%s", bgp_origin_str[attr->origin]); @@ -9968,7 +9968,7 @@ static void damp_route_vty_out(struct vty *vty, const struct prefix *p, use_json, NULL)); if (attr->aspath) - aspath_print_vty(vty, "%s", attr->aspath, " "); + aspath_print_vty(vty, attr->aspath); vty_out(vty, "%s", bgp_origin_str[attr->origin]); @@ -10045,7 +10045,7 @@ static void flap_route_vty_out(struct vty *vty, const struct prefix *p, vty_out(vty, "%*s ", 8, " "); if (attr->aspath) - aspath_print_vty(vty, "%s", attr->aspath, " "); + aspath_print_vty(vty, attr->aspath); vty_out(vty, "%s", bgp_origin_str[attr->origin]); @@ -10329,7 +10329,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn, attr->aspath->json); } else { if (attr->aspath->segments) - aspath_print_vty(vty, " %s", attr->aspath, ""); + vty_out(vty, " %s", attr->aspath->str); else vty_out(vty, " Local"); }