modernize backfire 10.03 so it can be operational again
[openwrt-10.03/.git] / package / quagga / not-patches / patches-old / 100-bgpd_Display_configured_dampening_parameters.patch
1 From 06bd420d4646333bc7ed9964e348f19a942fcfe2 Mon Sep 17 00:00:00 2001
2 From: Balaji <balajig81@gmail.com>
3 Date: Mon, 16 Mar 2015 16:55:29 +0000
4 Subject: [PATCH] bgpd: Display of configured dampening parameters
5
6 Function to display configured bgp dampening parameters.
7
8 Signed-off-by: Balaji.G <balajig81@gmail.com>
9 [DL: formatting adjustments]
10 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 ---
12  bgpd/bgp_damp.c | 33 +++++++++++++++++++++++++++++++++
13  bgpd/bgp_damp.h |  2 ++
14  2 files changed, 35 insertions(+)
15
16 diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
17 index 0ffafb7..dd6c759 100644
18 --- a/bgpd/bgp_damp.c
19 +++ b/bgpd/bgp_damp.c
20 @@ -639,3 +639,36 @@ bgp_damp_reuse_time_vty (struct vty *vty, struct bgp_info *binfo,
21  
22    return  bgp_get_reuse_time (penalty, timebuf, len);
23  }
24 +
25 +int
26 +bgp_show_dampening_parameters (struct vty *vty, afi_t afi, safi_t safi)
27 +{
28 +  struct bgp *bgp;
29 +  bgp = bgp_get_default();
30 +
31 +  if (bgp == NULL)
32 +    {
33 +      vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
34 +      return CMD_WARNING;
35 +    }
36 +
37 +  if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
38 +    {
39 +      vty_out (vty, "Half-life time: %ld min%s",
40 +                    damp->half_life / 60, VTY_NEWLINE);
41 +      vty_out (vty, "Reuse penalty: %d%s",
42 +                    damp->reuse_limit, VTY_NEWLINE);
43 +      vty_out (vty, "Suppress penalty: %d%s",
44 +                    damp->suppress_value, VTY_NEWLINE);
45 +      vty_out (vty, "Max suppress time: %ld min%s",
46 +                    damp->max_suppress_time / 60, VTY_NEWLINE);
47 +      vty_out (vty, "Max supress penalty: %u%s",
48 +                    damp->ceiling, VTY_NEWLINE);
49 +      vty_out (vty, "%s", VTY_NEWLINE);
50 +    }
51 +  else
52 +    vty_out (vty, "dampening not enabled for %s%s",
53 +                  afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
54 +
55 +  return CMD_SUCCESS;
56 +}
57 diff --git a/bgpd/bgp_damp.h b/bgpd/bgp_damp.h
58 index e1d319b..16fd367 100644
59 --- a/bgpd/bgp_damp.h
60 +++ b/bgpd/bgp_damp.h
61 @@ -144,4 +144,6 @@ extern void bgp_damp_info_vty (struct vty *, struct bgp_info *);
62  extern const char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *,
63                                               char *, size_t);
64  
65 +extern int bgp_show_dampening_parameters (struct vty *vty, afi_t, safi_t);
66 +
67  #endif /* _QUAGGA_BGP_DAMP_H */
68 -- 
69 2.7.0
70