From 14d8590688be9e9660c3549a1147a4e3537d0512 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 21 Sep 2023 15:37:17 +0300 Subject: [PATCH] bgpd: Make sure dampening is enabled for the specified AFI/SAFI ``` (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=) at lib/sigevent.c:246 2 3 0x00005624ccabdee9 in bgp_get_reuse_time (penalty=, buf=buf@entry=0x7ffd19765590 "", len=len@entry=25, afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_UNICAST, use_json=, 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=, 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=, afi=, safi=, 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=, viewvrfname=, aa_nn=, community_list=, community_list_str=, community_list_name=, as_path_filter_name=, prefix_list=, accesslist_name=, rmap_name=, version=, version_str=, alias_name=, wide=, detail_json=, uj=, detail_routes=, all=, argv=0x5624ce3f32f0, argc=, vty=0x5624ce484e30) at bgpd/bgp_route.c:12863 9 show_ip_bgp (self=, vty=, argc=, 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=) at lib/vty.c:591 14 0x00007f55897deb9d in vty_execute (vty=0x5624ce484e30) at lib/vty.c:1354 15 0x00007f55897e23eb in vtysh_read (thread=) 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=, 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 --- bgpd/bgp_damp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index a6d0e74dc0..eaa2b85aba 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -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. */ @@ -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. */ -- 2.39.5