]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_fsm.c
bgpd: BGP assert when it tries to access peer which is closed.
authorSantosh P K <sapk@vmware.com>
Mon, 25 Nov 2019 16:49:38 +0000 (08:49 -0800)
committerSantosh P K <sapk@vmware.com>
Mon, 9 Dec 2019 17:10:57 +0000 (09:10 -0800)
commit74e00a55c19aec9be41b41887edba62cf6807474
tree1efdbea71f532c435855f1910e4f6a8b46033ae1
parentbb2d775cca77ef34738653fbc9f133f178642881
bgpd: BGP assert when it tries to access peer which is closed.

Problem: BGP peer pointer is present in keepalive hash table
even when socket has been closed in some race condition.
When keepalive tries to access this peer it asserts.

RCA: Below sequence of events causing assert.
1. Config node peer has went down due to TCP reset
   it's FD has been set to -1.
2. Doppelganger peer goes to established state and it has
   been added to peer hash table for keepalive when it was
   in openconfirm state.
3. Config node parameters including FD are exchanged with
   doppelganger. Doppelganger will not have FD -1.
4. Doppelganger will be deleted as part of this it will
   remove it from the keepalive peer hash table.
5. While removing from hash table it tries to acquire lock.
6. During this time keepalive thread has the lock and in
   a loop trying to send keepalive for peers in hash table.
7. It tries to send keepalive for doppelganger peer with fd
   set to -1 and asserts.

Signed-off-by: Santosh P K <sapk@vmware.com>
bgpd/bgp_fsm.c