diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-06-10 01:01:56 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-11-30 16:18:02 -0500 |
| commit | d8151687956100bba2e31ef2dd4bc4af78ec357f (patch) | |
| tree | b9c2f8d8e27049039e776e020a4c7cf6bbff11bd /bgpd/bgp_fsm.h | |
| parent | 6ee8ea1cf9b577e236e0f93265ee1e2cd0d7af31 (diff) | |
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>
Diffstat (limited to 'bgpd/bgp_fsm.h')
| -rw-r--r-- | bgpd/bgp_fsm.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgp_fsm.h b/bgpd/bgp_fsm.h index 131de40b5b..d021c9884a 100644 --- a/bgpd/bgp_fsm.h +++ b/bgpd/bgp_fsm.h @@ -50,6 +50,12 @@ #define BGP_MSEC_JITTER 10 +/* Status codes for bgp_event_update() */ +#define FSM_PEER_NOOP 0 +#define FSM_PEER_STOPPED 1 +#define FSM_PEER_TRANSFERRED 2 +#define FSM_PEER_TRANSITIONED 3 + /* Prototypes. */ extern void bgp_fsm_nht_update(struct peer *, int valid); extern int bgp_event(struct thread *); |
