From 50aef6f3b0e36b56cfa9f3d374be0c1d25c30c45 Mon Sep 17 00:00:00 2001 From: Chris Caputo Date: Tue, 23 Jun 2009 06:06:49 +0000 Subject: Fix "show ip bgp dampened-paths" garbage output. * bgpd/bgp_damp.c: Make bgp_damp_reuse_time_vty() accept a buffer and length, rather than returning a local var buffer whose contents can get trounced. Remove duplicate BGP_UPTIME_LEN define. * bgpd/bgp_damp.h: bgp_damp_reuse_time_vty() prototype change. * bgpd/bgp_route.c: Provide bgp_damp_reuse_time_vty() with a buffer and length. Remove duplicate BGP_UPTIME_LEN define. This problem was noticed in 2005... http://hibernia.jakma.org/~paul/patches/quagga-test.diff ...but the fix didn't make it into the code. Signed-off-by: Chris Caputo --- bgpd/bgp_route.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'bgpd/bgp_route.c') diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index a44d47ab..4f3f85b3 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -5810,6 +5810,7 @@ damp_route_vty_out (struct vty *vty, struct prefix *p, { struct attr *attr; int len; + char timebuf[BGP_UPTIME_LEN]; /* short status lead text */ route_vty_short_status_out (vty, binfo); @@ -5827,7 +5828,7 @@ damp_route_vty_out (struct vty *vty, struct prefix *p, else vty_out (vty, "%*s", len, " "); - vty_out (vty, "%s ", bgp_damp_reuse_time_vty (vty, binfo)); + vty_out (vty, "%s ", bgp_damp_reuse_time_vty (vty, binfo, timebuf, BGP_UPTIME_LEN)); /* Print attribute */ attr = binfo->attr; @@ -5843,8 +5844,6 @@ damp_route_vty_out (struct vty *vty, struct prefix *p, vty_out (vty, "%s", VTY_NEWLINE); } -#define BGP_UPTIME_LEN 25 - /* flap route */ static void flap_route_vty_out (struct vty *vty, struct prefix *p, @@ -5888,7 +5887,7 @@ flap_route_vty_out (struct vty *vty, struct prefix *p, if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED) && ! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY)) - vty_out (vty, "%s ", bgp_damp_reuse_time_vty (vty, binfo)); + vty_out (vty, "%s ", bgp_damp_reuse_time_vty (vty, binfo, timebuf, BGP_UPTIME_LEN)); else vty_out (vty, "%*s ", 8, " "); -- cgit v1.2.1