mirror_frr/bgpd
Donald Sharp f1b1efdefc bgpd: Don't try to recursively hold peer io mutex
BGP was modified in a0b937de42
to grab the peer->io_mtx before validating the header to ensure
that the input Queue was not being modified by anyone else at that
moment in time.  Unfortunately validate_header can detect a problem
and attempt to relock the mutex, which deadlocks.  This deadlock in
the bgp_io pthread is the lone deadlock at first, eventually though
bgp attempts to write another packet to the peer( say when the
it's time to send the next packet ) and the main pthread of bgpd
becomes deadlocked and then the whole bgpd process is stuck at that
point in time leaving us dead in the water.

The point of locking the mutex earlier was to ensure that the input
Queue wasn't being modified by anyone else, (Say reading off it )
as that we wanted to ensure that we don't hold more packets then necessary.

Let's grab the mutex long enough to look at the input Q size, this
ensure that we have room and then we can validate_header and do the right
thing from there.  We'll need to lock the mutex when we actually move it
into the input Q as well.

Fixes: #12725
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-02 16:39:01 -05:00
..
rfapi bgpd/rfapi: add missing printf attribute 2023-02-01 03:00:22 +01:00
rfp-example *: Properly use memset() when zeroing 2022-05-11 14:08:47 +03:00
.gitignore *: cleanup .gitignore files 2018-09-08 21:30:42 +02:00
bgp_addpath_types.h bgpd: Re-use TX Addpath IDs where possible 2018-11-10 00:16:36 +00:00
bgp_addpath.c bgpd: Print out useful information about peer 2022-12-16 09:32:44 -05:00
bgp_addpath.h bgp: rename bgp_node to bgp_dest 2020-06-23 17:32:52 +02:00
bgp_advertise.c bgpd: Convert from bgp_clock() to monotime() 2022-08-24 08:23:40 -04:00
bgp_advertise.h bgpd: Rename baa_new/baa_free/etc functions to be human-readable 2022-07-25 16:45:06 +03:00
bgp_aspath.c bgpd: fix format string mess in AS-path printing 2023-01-27 12:01:20 +01:00
bgp_aspath.h bgpd: fix format string mess in AS-path printing 2023-01-27 12:01:20 +01:00
bgp_attr_evpn.c *: Properly use memset() when zeroing 2022-05-11 14:08:47 +03:00
bgp_attr_evpn.h bgpd: Fixing memcmp to avoid coverity issue 2022-01-31 21:50:50 -08:00
bgp_attr.c bgpd: Add missing no form for neighbor path-attribute discard cmd 2023-01-22 22:17:39 +02:00
bgp_attr.h bgpd: Add missing no form for neighbor path-attribute discard cmd 2023-01-22 22:17:39 +02:00
bgp_bfd.c bgpd: Don't warning twice for neighbor_bfd_check_controlplane_failure 2023-01-11 15:58:10 +02:00
bgp_bfd.h bgpd: improve BFD with timers configuration 2021-03-23 12:40:11 -03:00
bgp_bmp.c Merge pull request #12196 from opensourcerouting/xref-vtysh 2022-11-03 08:54:09 -04:00
bgp_bmp.h bmp: add a interface source to bmp connect command 2022-06-16 12:51:11 +02:00
bgp_btoa.c bgpd: changes for code maintainability 2022-09-02 00:31:40 +05:30
bgp_clist.c Revert "bgpd: Drop internet community check from community_list_match()" 2022-08-24 08:46:56 +03:00
bgp_clist.h bgpd: Align bgp_clist.h to our standards 2022-05-12 10:20:28 -04:00
bgp_community_alias.c bgpd: Fix memory leak for community alias 2022-07-16 16:18:07 +03:00
bgp_community_alias.h bgpd: fix memory leaks in bgp_alias2community_str 2021-08-11 12:09:15 +03:00
bgp_community.c bgpd: Fix memory leak for community stuff 2022-07-16 16:41:31 +03:00
bgp_community.h bgpd: Implement ACCEPT_OWN extended community 2022-10-12 17:48:43 +03:00
bgp_conditional_adv.c bgpd: Notify BGP conditional advertisement thread when the peer goes down 2022-10-20 15:21:47 +03:00
bgp_conditional_adv.h bgpd: conditional advertisement code cleanup 2022-10-06 12:43:05 +05:30
bgp_damp.c bgpd: fix time truncation due to parameter type 2023-01-20 16:20:56 -03:00
bgp_damp.h bgpd: Align bgp_damp.h to our standards 2022-05-12 10:20:28 -04:00
bgp_debug.c Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_debug.h Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_dump.c *: no-warn pragmas for non-const format strings 2023-01-27 12:01:20 +01:00
bgp_dump.h bgpd: Align bgp_dump.h to our standards 2022-05-12 10:20:28 -04:00
bgp_ecommunity.c bgpd: inet_ntop() adjustments 2022-11-29 17:36:13 +02:00
bgp_ecommunity.h bgpd: Handle Origin Validation State extended community via route-map match 2022-09-04 21:54:47 +03:00
bgp_encap_tlv.c *: Replace 4/16 integers to IPV4_MAX_BYTELEN/IPV6_MAX_BYTELEN 2021-07-01 23:54:39 +03:00
bgp_encap_tlv.h *: reindent 2017-07-17 14:04:07 +02:00
bgp_encap_types.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_errors.c bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_errors.h bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_evpn_mh.c bgpd: bgp_update and bgp_withdraw never return failures 2023-01-30 16:02:23 -05:00
bgp_evpn_mh.h bgpd: remove one unnecessary parameter for evpn-mh 2022-05-09 08:27:20 -04:00
bgp_evpn_private.h Merge pull request #12081 from sworleys/EMM-upstream 2022-11-17 16:46:58 +02:00
bgp_evpn_vty.c bgpd: Convert evpn output to not pretty print json 2023-02-02 10:42:21 -05:00
bgp_evpn_vty.h bgpd: fix show bgp all with evpn 2022-12-29 17:05:01 +01:00
bgp_evpn.c bgpd: bgp_update and bgp_withdraw never return failures 2023-01-30 16:02:23 -05:00
bgp_evpn.h bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int 2022-02-01 13:31:16 +02:00
bgp_filter.c bgpd: Free memory for as-path filter if regexp is wrong 2022-07-22 17:43:45 +03:00
bgp_filter.h bgpd: add seqno in bgp as-path access-list policy 2021-03-17 22:06:53 -07:00
bgp_flowspec_private.h bgpd, lib: support for flow_label flowspec type 2020-08-21 13:37:08 +02:00
bgp_flowspec_util.c *: Properly use memset() when zeroing 2022-05-11 14:08:47 +03:00
bgp_flowspec_util.h bgpd: ipv6 flowspec address decoding and validation 2020-08-21 13:37:08 +02:00
bgp_flowspec_vty.c bgpd: inet_ntop() adjustments 2022-11-29 17:36:13 +02:00
bgp_flowspec.c bgpd: bgp_update and bgp_withdraw never return failures 2023-01-30 16:02:23 -05:00
bgp_flowspec.h bgpd: flowspec code support for ipv6 2020-08-21 13:37:08 +02:00
bgp_fsm.c bgpd: Vanish FQDN capability hostname/domainname before handling new BGP OPEN 2023-01-30 23:34:41 +02:00
bgp_fsm.h Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_io.c bgpd: Don't try to recursively hold peer io mutex 2023-02-02 16:39:01 -05:00
bgp_io.h bgpd: raise default & max r/w quanta to 64 2019-10-14 18:41:53 +00:00
bgp_keepalives.c Merge pull request #12641 from samanvithab/bgpd_crash 2023-01-17 09:40:05 -05:00
bgp_keepalives.h bgpd: Fix crash during shutdown due to race condition 2023-01-16 04:22:11 -08:00
bgp_label.c bgpd: Drop label_ntop/label_pton functions 2022-06-01 16:45:22 +03:00
bgp_label.h bgpd: Drop label_ntop/label_pton functions 2022-06-01 16:45:22 +03:00
bgp_labelpool.c *: Drop deprecated incorrect JSON fields with wrong naming 2023-01-31 10:18:28 +02:00
bgp_labelpool.h bgpd: improve labelpool performance at scale 2022-08-31 08:21:27 -07:00
bgp_lcommunity.c *: Fix spelling of strucutre 2022-04-19 08:19:37 -04:00
bgp_lcommunity.h bgpd: Allow setting BGP [large]community in route-maps 2022-04-09 17:34:06 +03:00
bgp_mac.c bgpd: bgp_update and bgp_withdraw never return failures 2023-01-30 16:02:23 -05:00
bgp_mac.h bgpd: Rework code to use const struct prefix 2020-03-24 07:51:41 -04:00
bgp_main.c bgpd: add 'mpls bgp forwarding' to ease mpls vpn ebgp peering 2022-09-05 22:26:33 +02:00
bgp_memory.c Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_memory.h Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_mpath.c Revert "Merge pull request #11127 from louis-6wind/bgp-leak" 2023-01-13 08:13:52 -05:00
bgp_mpath.h bgpd: Align bgp_mpath.h to our standards 2022-05-12 10:20:28 -04:00
bgp_mplsvpn_snmp.c bgpd: display the IGP metric of the ultimate path in snmp 2022-12-15 17:10:59 +01:00
bgp_mplsvpn_snmp.h bgpd: implement mplsL3VpnVrfRtTable 2021-02-02 09:37:13 +00:00
bgp_mplsvpn.c bgpd: Skip RD match if ACCEPT_OWN is not enabled 2023-01-20 15:28:39 +09:00
bgp_mplsvpn.h bgpd: Add no sid vpn per-vrf export command 2022-10-18 16:08:24 +02:00
bgp_network.c bgpd: When creating peer convey if it is a CONFIG_NODE or not 2022-12-05 09:11:22 -05:00
bgp_network.h bmp: add a interface source to bmp connect command 2022-06-16 12:51:11 +02:00
bgp_nexthop.c bgpd: only unimport routes if tunnel-ip changes 2023-01-27 11:11:44 -05:00
bgp_nexthop.h bgpd: only unimport routes if tunnel-ip changes 2023-01-27 11:11:44 -05:00
bgp_nht.c Revert "Merge pull request #11127 from louis-6wind/bgp-leak" 2023-01-13 08:13:52 -05:00
bgp_nht.h bgpd: prevent routes loop through itself 2021-07-12 13:57:36 +02:00
bgp_open.c bgpd: Deprecate some unused BGP stuff 2023-01-14 21:30:35 +02:00
bgp_open.h bgpd: Check and print if we receive ORF reserved type 2022-11-03 16:19:21 +02:00
bgp_packet.c bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw 2023-02-01 23:07:56 +02:00
bgp_packet.h bgpd: avoid notify race between io and main pthreads 2022-09-08 16:14:36 -04:00
bgp_pbr.c bgpd: inet_ntop() adjustments 2022-11-29 17:36:13 +02:00
bgp_pbr.h bgpd: fallback proto icmp/v6 to appropriate l3 filter 2020-08-21 13:37:08 +02:00
bgp_rd.c bgpd: Use %pRD for prefix_rd2str() 2022-09-22 13:12:11 +03:00
bgp_rd.h bgpd: support for Ethernet Segments and Type-1/EAD routes 2020-08-05 06:46:12 -07:00
bgp_regex.c *: reindent 2017-07-17 14:04:07 +02:00
bgp_regex.h lib: Add PCRE2 support 2022-11-07 21:23:53 +02:00
bgp_route.c lib, bgpd: Add ability to specify that some json output should not be pretty 2023-02-02 10:28:19 -05:00
bgp_route.h bgpd: bgp_update and bgp_withdraw never return failures 2023-01-30 16:02:23 -05:00
bgp_routemap_nb_config.c bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_routemap_nb.c bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_routemap_nb.h bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_routemap.c bgpd: fix when route-map changes the link local nexthop for vpnv6 2023-01-24 08:04:27 +01:00
bgp_rpki.c bgpd: rpki was decrementing the node lock one time too many 2022-11-08 14:47:00 -05:00
bgp_rpki.h bgpd: Convert RPKI states to an enum and use them 2021-03-26 08:23:33 -04:00
bgp_script.c bgpd: Make sure we pop the table from the stack when decoding struct attr 2022-03-29 17:47:28 +03:00
bgp_script.h bgpd: Update bgp_script encoders and decoders 2021-06-22 05:03:07 +08:00
bgp_snmp_bgp4.c bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry) 2022-11-14 10:43:03 +02:00
bgp_snmp_bgp4.h bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry) 2022-11-14 10:43:03 +02:00
bgp_snmp_bgp4v2.c Revert "Merge pull request #11127 from louis-6wind/bgp-leak" 2023-01-13 08:13:52 -05:00
bgp_snmp_bgp4v2.h bgpd: Implement SNMP BGP4V2-MIB (bgp4V2NlriTable), part 1 2022-12-12 21:37:39 +02:00
bgp_snmp.c bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry) 2022-11-14 10:43:03 +02:00
bgp_snmp.h bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerEntry) 2022-11-14 10:43:03 +02:00
bgp_table.c *: use semicolon after printfrr_ext_autoreg_{p,d} 2022-01-14 13:33:57 +01:00
bgp_table.h bgpd: Implement Accumulated IGP Metric Attribute for BGP 2022-10-26 11:26:57 +03:00
bgp_trace.c *: make sure config.h or zebra.h is first 2021-04-23 12:06:35 +02:00
bgp_trace.h bgpd: Add lttng tracepoints for bgp_path_info_add/free 2022-12-23 10:04:41 +02:00
bgp_updgrp_adv.c bgpd: Announce labeled-unicast default-originate 2022-12-07 23:18:07 +02:00
bgp_updgrp_packet.c bgpd: Announce labeled-unicast default-originate 2022-12-07 23:18:07 +02:00
bgp_updgrp.c bgpd: Do not send routes back received from a peer 2023-01-14 21:30:07 +02:00
bgp_updgrp.h bgpd: Adopt addpath functionality for labeled-unicast 2022-12-06 21:39:15 +02:00
bgp_vnc_types.h bgpd: #if ENABLE_BGP_VNC -> #ifdef ENABLE_BGP_VNC 2020-04-01 15:05:26 -04:00
bgp_vpn.c bgpd: Convert vty_out to vty_json for JSON 2021-11-25 17:51:12 +02:00
bgp_vpn.h bgpd/ospfd: make bgp and ospf json response a bit more consistent 2018-08-30 12:40:18 +00:00
bgp_vty.c bgpd: fix silly format string SNAFU 2023-01-27 12:01:20 +01:00
bgp_vty.h bgpd: Fix graceful-restart JSON outputs and the crash 2022-12-11 21:31:49 +02:00
bgp_zebra.c Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00
bgp_zebra.h bgpd: add 'mpls bgp forwarding' to ease mpls vpn ebgp peering 2022-09-05 22:26:33 +02:00
bgpd.c bgpd: Free peer's hostname (aka FQDN capability stuff) 2023-01-30 23:22:58 +02:00
bgpd.h Merge pull request #12666 from donaldsharp/bgp_outq_limit 2023-01-20 11:59:34 +02:00
Makefile build: non-recursive bgpd & rfp 2018-09-08 21:25:59 +02:00
subdir.am Revert "bgpd: optimal router reflection cli and fsm changes" 2023-01-17 18:15:28 +02:00