Skip to content

Commit

Permalink
bgpd: Make sure dampening is enabled for the specified AFI/SAFI
Browse files Browse the repository at this point in the history
```
(gdb) bt
0  raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x00007f55897c6ab0 in core_handler (signo=11, siginfo=0x7ffd19764bb0, context=<optimized out>) at lib/sigevent.c:246
2  <signal handler called>
3  0x00005624ccabdee9 in bgp_get_reuse_time (penalty=<optimized out>, buf=buf@entry=0x7ffd19765590 "", len=len@entry=25, afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_UNICAST, use_json=<optimized out>, json=0x0)
    at bgpd/bgp_damp.c:498
4  0x00005624ccabf5e7 in bgp_damp_reuse_time_vty (vty=vty@entry=0x5624ce484e30, path=path@entry=0x5624cdd797a0, timebuf=timebuf@entry=0x7ffd19765590 "", len=len@entry=25, afi=afi@entry=AFI_IP,
    safi=safi@entry=SAFI_UNICAST, use_json=false, json=0x0) at bgpd/bgp_damp.c:635
5  0x00005624cca146a9 in damp_route_vty_out (afi=AFI_IP, json_paths=0x0, use_json=false, safi=SAFI_UNICAST, display=<optimized out>, path=0x5624cdd797a0, p=0x5624ce3f3160, vty=0x5624ce484e30)
    at bgpd/bgp_route.c:9852
6  bgp_show_table (vty=0x5624ce484e30, bgp=0x5624ce400950, safi=safi@entry=SAFI_UNICAST, table=0x5624ce409300, type=type@entry=bgp_show_type_dampend_paths, output_arg=0x0, rd=0x0, is_last=1, output_cum=0x0,
    total_cum=0x0, json_header_depth=0x7ffd19765830, show_flags=0, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11448
7  0x00005624cca15f74 in bgp_show (vty=vty@entry=0x5624ce484e30, bgp=<optimized out>, afi=<optimized out>, safi=<optimized out>, type=type@entry=bgp_show_type_dampend_paths, output_arg=output_arg@entry=0x0,
    show_flags=0, rpki_target_state=RPKI_NOT_BEING_USED) at bgpd/bgp_route.c:11702
8  0x00005624cca17679 in show_ip_bgp_magic (self=<optimized out>, viewvrfname=<optimized out>, aa_nn=<optimized out>, community_list=<optimized out>, community_list_str=<optimized out>,
    community_list_name=<optimized out>, as_path_filter_name=<optimized out>, prefix_list=<optimized out>, accesslist_name=<optimized out>, rmap_name=<optimized out>, version=<optimized out>,
    version_str=<optimized out>, alias_name=<optimized out>, wide=<optimized out>, detail_json=<optimized out>, uj=<optimized out>, detail_routes=<optimized out>, all=<optimized out>, argv=0x5624ce3f32f0,
    argc=<optimized out>, vty=0x5624ce484e30) at bgpd/bgp_route.c:12863
9  show_ip_bgp (self=<optimized out>, vty=<optimized out>, argc=<optimized out>, argv=0x5624ce3f32f0) at ./bgpd/bgp_route_clippy.c:514
10 0x00007f55897618ee in cmd_execute_command_real (vline=vline@entry=0x5624ce427020, vty=vty@entry=0x5624ce484e30, cmd=cmd@entry=0x0, up_level=up_level@entry=0) at lib/command.c:993
11 0x00007f5589761a91 in cmd_execute_command (vline=vline@entry=0x5624ce427020, vty=vty@entry=0x5624ce484e30, cmd=0x0, vtysh=vtysh@entry=0) at lib/command.c:1051
12 0x00007f5589761c30 in cmd_execute (vty=vty@entry=0x5624ce484e30, cmd=cmd@entry=0x5624ce47b1b0 "show bgp dampening damp", matched=matched@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1218
13 0x00007f55897de95e in vty_command (vty=vty@entry=0x5624ce484e30, buf=<optimized out>) at lib/vty.c:591
14 0x00007f55897deb9d in vty_execute (vty=0x5624ce484e30) at lib/vty.c:1354
15 0x00007f55897e23eb in vtysh_read (thread=<optimized out>) at lib/vty.c:2362
16 0x00007f55897d9426 in event_call (thread=thread@entry=0x7ffd19767e70) at lib/event.c:1971
17 0x00007f5589789df8 in frr_run (master=0x5624cdc42100) at lib/libfrr.c:1213
18 0x00005624cc985f65 in main (argc=<optimized out>, argv=0x7ffd197680d8) at bgpd/bgp_main.c:510
(gdb) frame 4
(gdb) p damp[1][1]
$4 = {suppress_value = 0, reuse_limit = 0, max_suppress_time = 0, half_life = 0, tmax = 0, reuse_list_size = 0, reuse_index_size = 0, ceiling = 0, decay_rate_per_tick = 0, decay_array_size = 0,
  scale_factor = 0, reuse_scale_factor = 0, decay_array = 0x0, reuse_index = 0x0, reuse_list = 0x0, reuse_offset = 0, no_reuse_list = 0x0, t_reuse = 0x0, afi = AFI_UNSPEC, safi = SAFI_UNSPEC}
(gdb) p damp[2][1]
$5 = {suppress_value = 1, reuse_limit = 1, max_suppress_time = 1800, half_life = 60, tmax = 0, reuse_list_size = 181, reuse_index_size = 1024, ceiling = 1073741824, decay_rate_per_tick = 0,
  decay_array_size = 360, scale_factor = 9.5367431729442842e-07, reuse_scale_factor = 0, decay_array = 0x5624ce483780, reuse_index = 0x5624ce481320, reuse_list = 0x5624ce482c20, reuse_offset = 7,
  no_reuse_list = 0x0, t_reuse = 0x5624ce3ec840, afi = AFI_UNSPEC, safi = SAFI_UNSPEC}
(gdb)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
  • Loading branch information
ton31337 committed Sep 22, 2023
1 parent 4d64bad commit 14d8590
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bgpd/bgp_damp.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,9 @@ void bgp_damp_info_vty(struct vty *vty, struct bgp_path_info *path, afi_t afi,

/* If dampening is not enabled or there is no dampening information,
return immediately. */
if (!bdc || !bdi)
if (!CHECK_FLAG(path->peer->bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING) ||
!bdi)
return;

/* Calculate new penalty. */
Expand Down Expand Up @@ -624,7 +626,9 @@ const char *bgp_damp_reuse_time_vty(struct vty *vty, struct bgp_path_info *path,

/* If dampening is not enabled or there is no dampening information,
return immediately. */
if (!bdc || !bdi)
if (!CHECK_FLAG(path->peer->bgp->af_flags[afi][safi],
BGP_CONFIG_DAMPENING) ||
!bdi)
return NULL;

/* Calculate new penalty. */
Expand Down

0 comments on commit 14d8590

Please sign in to comment.