]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Initialise timebuf arrays to zeros for dampening reuse timer
authorDonatas Abraitis <donatas@opensourcerouting.org>
Thu, 21 Sep 2023 13:00:10 +0000 (16:00 +0300)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Sat, 23 Sep 2023 13:52:26 +0000 (13:52 +0000)
Avoid having something like this in outputs:

Before:
```
munet> r1 shi vtysh -c 'show bgp dampening damp'
BGP table version is 10, local router ID is 10.10.10.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          From             Reuse    Path
 *d 2001:db8:1::1/128
                    2001:db8::2      (null) 65002 ?
 *d 2001:db8:2::1/128
                    2001:db8::2      (null) 65002 ?
 *d 2001:db8:3::1/128
                    2001:db8::2      (null) 65002 ?
 *d 2001:db8:4::1/128
                    2001:db8::2      (null) 65002 ?
 *d 2001:db8:5::1/128
                    2001:db8::2      (null) 65002 ?

Displayed  5 routes and 5 total paths

munet> r1 shi vtysh -c 'show bgp dampening flap'
BGP table version is 10, local router ID is 10.10.10.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          From            Flaps Duration Reuse    Path
 *d 2001:db8:1::1/128
                    2001:db8::2     2    00:03:10 (null) 65002 ?
 *d 2001:db8:2::1/128
                    2001:db8::2     2    00:03:10 (null) 65002 ?
 *d 2001:db8:3::1/128
                    2001:db8::2     2    00:03:10 (null) 65002 ?
 *d 2001:db8:4::1/128
                    2001:db8::2     2    00:03:10 (null) 65002 ?
 *d 2001:db8:5::1/128
                    2001:db8::2     2    00:03:10 (null) 65002 ?

Displayed  5 routes and 5 total paths
```

After:

```
munet> r1 shi vtysh -c 'show bgp dampening damp '
BGP table version is 10, local router ID is 10.10.10.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          From             Reuse    Path
 *d 2001:db8:1::1/128
                    2001:db8::2      00:00:00 65002 ?
 *d 2001:db8:2::1/128
                    2001:db8::2      00:00:00 65002 ?
 *d 2001:db8:3::1/128
                    2001:db8::2      00:00:00 65002 ?
 *d 2001:db8:4::1/128
                    2001:db8::2      00:00:00 65002 ?
 *d 2001:db8:5::1/128
                    2001:db8::2      00:00:00 65002 ?

Displayed  5 routes and 5 total paths

munet> r1 shi vtysh -c 'show bgp dampening flap'
BGP table version is 10, local router ID is 10.10.10.1, vrf id 0
Default local pref 100, local AS 65001
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          From            Flaps Duration Reuse    Path
 *d 2001:db8:1::1/128
                    2001:db8::2     2    00:00:15 00:00:00 65002 ?
 *d 2001:db8:2::1/128
                    2001:db8::2     2    00:00:15 00:00:00 65002 ?
 *d 2001:db8:3::1/128
                    2001:db8::2     2    00:00:15 00:00:00 65002 ?
 *d 2001:db8:4::1/128
                    2001:db8::2     2    00:00:15 00:00:00 65002 ?
 *d 2001:db8:5::1/128
                    2001:db8::2     2    00:00:15 00:00:00 65002 ?

Displayed  5 routes and 5 total paths
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit c39506d80f3e42059e00e562f0c5b376a5246ddd)

bgpd/bgp_damp.c
bgpd/bgp_route.c

index eaa2b85abaa6d66e49f21686fd7e2b731e4e8d44..80425ebe7adb3e68457214ce7baf94ba3b01d868 100644 (file)
@@ -558,7 +558,7 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *path, afi_t afi,
 {
        struct bgp_damp_info *bdi;
        time_t t_now, t_diff;
-       char timebuf[BGP_UPTIME_LEN];
+       char timebuf[BGP_UPTIME_LEN] = {};
        int penalty;
        struct bgp_damp_config *bdc = &damp[afi][safi];
 
index c74981c298af9ba1052252340bdb7de24f19d8ec..3d27e48185380b332cd4160b6bf13037973ea8dd 100644 (file)
@@ -9972,7 +9972,7 @@ static void damp_route_vty_out(struct vty *vty, const struct prefix *p,
 {
        struct attr *attr = path->attr;
        int len;
-       char timebuf[BGP_UPTIME_LEN];
+       char timebuf[BGP_UPTIME_LEN] = {};
        json_object *json_path = NULL;
 
        if (use_json)
@@ -10031,7 +10031,7 @@ static void flap_route_vty_out(struct vty *vty, const struct prefix *p,
 {
        struct attr *attr = path->attr;
        struct bgp_damp_info *bdi;
-       char timebuf[BGP_UPTIME_LEN];
+       char timebuf[BGP_UPTIME_LEN] = {};
        int len;
        json_object *json_path = NULL;