summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_damp.c8
-rw-r--r--bgpd/bgp_damp.h3
-rw-r--r--bgpd/bgp_route.c7
3 files changed, 8 insertions, 10 deletions
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index ba25f4d1..3283d448 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -541,8 +541,6 @@ bgp_config_write_damp (struct vty *vty)
VTY_NEWLINE);
}
-#define BGP_UPTIME_LEN 25
-
char *
bgp_get_reuse_time (unsigned int penalty, char *buf, size_t len)
{
@@ -616,11 +614,11 @@ bgp_damp_info_vty (struct vty *vty, struct bgp_info *binfo)
}
char *
-bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_info *binfo)
+bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_info *binfo,
+ char *timebuf, size_t len)
{
struct bgp_damp_info *bdi;
time_t t_now, t_diff;
- char timebuf[BGP_UPTIME_LEN];
int penalty;
if (!binfo->extra)
@@ -639,5 +637,5 @@ bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_info *binfo)
t_diff = t_now - bdi->t_updated;
penalty = bgp_damp_decay (t_diff, bdi->penalty);
- return bgp_get_reuse_time (penalty, timebuf, BGP_UPTIME_LEN);
+ return bgp_get_reuse_time (penalty, timebuf, len);
}
diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h
index 17c31cb9..8c762960 100644
--- a/bgpd/bgp_damp.h
+++ b/bgpd/bgp_damp.h
@@ -142,6 +142,7 @@ extern char * bgp_get_reuse_time (unsigned int, char*, size_t);
extern int bgp_damp_decay (time_t, int);
extern void bgp_config_write_damp (struct vty *);
extern void bgp_damp_info_vty (struct vty *, struct bgp_info *);
-extern char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *);
+extern char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *,
+ char *, size_t);
#endif /* _QUAGGA_BGP_DAMP_H */
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 0d5f98b9..45b76d1b 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5788,6 +5788,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);
@@ -5805,7 +5806,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;
@@ -5821,8 +5822,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,
@@ -5866,7 +5865,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, " ");