]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_route.c
bgpd: Fix `dampening dampened-paths json` crash
authorDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 15 Jul 2021 12:55:46 +0000 (15:55 +0300)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Thu, 15 Jul 2021 12:55:46 +0000 (15:55 +0300)
commite5be8c1dac44958550dee57350b732920aa27d4e
treeb6ebc37c1fddc41be99bcf5354e7b3e46beb4834
parentac43358c17aa82e9cbe47715213b1bd50cc29a67
bgpd: Fix `dampening dampened-paths json` crash

```
5  0x00007fccab6fac39 in json_object_boolean_true_add (obj=<optimized out>, key=<optimized out>) at lib/json.c:70
No locals.
6  0x000055c7b8c08ae5 in route_vty_short_status_out (vty=<optimized out>, path=0x55c7bb37dcf0, p=<optimized out>, json_path=0x55c7bb3735a0)
    at bgpd/bgp_route.c:8566
        rpki_state = RPKI_NOT_BEING_USED
7  0x000055c7b8c22d1b in flap_route_vty_out (afi=AFI_IP, json=0x55c7bb3735a0, use_json=true, safi=SAFI_UNICAST, display=0, path=0x55c7bb37dcf0,
    p=0x55c7bb37dea0, vty=0x55c7bb39e4c0) at bgpd/bgp_route.c:9600
        attr = <optimized out>
        bdi = 0x55c7bb377950
        timebuf = '\000' <repeats 24 times>
        len = <optimized out>
8  bgp_show_table (vty=0x55c7bb39e4c0, bgp=0x55c7bb316300, safi=safi@entry=SAFI_UNICAST, table=0x55c7bb314d90, type=bgp_show_type_flap_statistics,
    output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0, total_cum=0x0, json_header_depth=0x7ffeefd649f8, show_flags=1, rpki_target_state=RPKI_NOT_BEING_USED)
    at bgpd/bgp_route.c:11110
```

With fix:

```
exit1-debian-9# sh ip bgp dampening dampened-paths
BGP table version is 16, local router ID is 10.10.10.200, 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 10.0.0.0/24      192.168.0.2      00:21:08 65000 ?
*d 10.10.10.100/32  192.168.0.2      00:21:08 65000 ?
*d 192.168.1.0/24   192.168.0.2      00:21:08 65000 ?

Displayed  3 routes and 10 total paths
exit1-debian-9# sh ip bgp dampening dampened-paths json
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 16,
 "routerId": "10.10.10.200",
 "defaultLocPrf": 100,
 "localAS": 65001,
 "routes": { "10.0.0.0/24": [
  {
    "valid":true,
    "damped":true,
    "pathFrom":"external",
    "reuseTimerMsecs":1263000,
    "asPath":"65000",
    "origin":"?",
    "peerHost":"192.168.0.2"
  }
],"10.10.10.100/32": [
  {
    "valid":true,
    "damped":true,
    "pathFrom":"external",
    "reuseTimerMsecs":1263000,
    "asPath":"65000",
    "origin":"?",
    "peerHost":"192.168.0.2"
  }
],"192.168.1.0/24": [
  {
    "valid":true,
    "damped":true,
    "pathFrom":"external",
    "reuseTimerMsecs":1263000,
    "asPath":"65000",
    "origin":"?",
    "peerHost":"192.168.0.2"
  }
] }  }
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_route.c