diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2023-08-25 10:28:02 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2023-08-25 10:28:02 -0400 |
| commit | d4a9b103b7e1af87643fc9542ca9dff6da967c37 (patch) | |
| tree | d0d587f8719ac86e3e80538efd1883bc894714d3 /bgpd/bgp_fsm.c | |
| parent | 8dd97a7404255d77115182aa4a2bd7cd58fcd9e3 (diff) | |
bgpd: bgp_event_update switch to a switch
The return code from a event handling perspective
is an enum. Let's intentionally make it a switch
so that all cases are ensured to be covered now
and in the future.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_fsm.c')
| -rw-r--r-- | bgpd/bgp_fsm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 233eab9b71..d08159eb50 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -2618,6 +2618,7 @@ int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) struct peer *other; int passive_conn = 0; int dyn_nbr; + struct peer_connection *connection = peer->connection; other = peer->doppelganger; passive_conn = @@ -2643,7 +2644,9 @@ int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) ret = (*(FSM[peer->connection->status - 1][event - 1].func))( peer->connection); - if (ret >= BGP_FSM_SUCCESS) { + switch (ret) { + case BGP_FSM_SUCCESS: + case BGP_FSM_SUCCESS_STATE_TRANSFER: if (ret == BGP_FSM_SUCCESS_STATE_TRANSFER && next == Established) { /* The case when doppelganger swap accurred in @@ -2670,10 +2673,9 @@ int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) /* Make sure timer is set. */ bgp_timer_set(peer); - - } else { - struct peer_connection *connection = peer->connection; - + break; + case BGP_FSM_FAILURE: + case BGP_FSM_FAILURE_AND_DELETE: /* * If we got a return value of -1, that means there was an * error, restart the FSM. Since bgp_stop() was called on the @@ -2697,6 +2699,8 @@ int bgp_event_update(struct peer *peer, enum bgp_fsm_events event) bgp_timer_set(peer); } fsm_result = FSM_PEER_STOPPED; + + break; } return fsm_result; |
