]> git.proxmox.com Git - mirror_frr.git/commit
bgpd: fix bgp_packet.c / bgp_fsm.c organization
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sat, 10 Jun 2017 01:01:56 +0000 (01:01 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 30 Nov 2017 21:18:02 +0000 (16:18 -0500)
commitd8151687956100bba2e31ef2dd4bc4af78ec357f
treeb9c2f8d8e27049039e776e020a4c7cf6bbff11bd
parent6ee8ea1cf9b577e236e0f93265ee1e2cd0d7af31
bgpd: fix bgp_packet.c / bgp_fsm.c organization

Despaghettification of bgp_packet.c and bgp_fsm.c

Sometimes we call bgp_event_update() inline packet parsing.
Sometimes we post events instead.
Sometimes we increment packet counters in the FSM.
Sometimes we do it in packet routines.
Sometimes we update EOR's in FSM.
Sometimes we do it in packet routines.

Fix the madness.

bgp_process_packet() is now the centralized place to:
- Update message counters
- Execute FSM events in response to incoming packets

FSM events are now executed directly from this function instead of being
queued on the thread_master. This is to ensure that the FSM contains the
proper state after each packet is parsed. Otherwise there could be race
conditions where two packets are parsed in succession without the
appropriate FSM update in between, leading to session closure due to
receiving inappropriate messages for the current FSM state.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_fsm.c
bgpd/bgp_fsm.h
bgpd/bgp_io.c
bgpd/bgp_packet.c