afi_t afi;
safi_t safi;
int fd;
- int status, pstatus;
+ enum bgp_fsm_status status, pstatus;
enum bgp_fsm_events last_evt, last_maj_evt;
assert(from_peer != NULL);
bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
+ case BGP_STATUS_MAX:
+ flog_err(EC_LIB_DEVELOPMENT,
+ "BGP_STATUS_MAX while a legal state is not valid state for the FSM");
+ break;
}
}
/* Finite State Machine structure */
static const struct {
int (*func)(struct peer *);
- int next_state;
+ enum bgp_fsm_status next_state;
} FSM[BGP_STATUS_MAX - 1][BGP_EVENTS_MAX - 1] = {
{
/* Idle state: In Idle state, all events other than BGP_Start is
int bgp_event_update(struct peer *peer, enum bgp_fsm_events event)
{
- int next;
+ enum bgp_fsm_status next;
int ret = 0;
struct peer *other;
int passive_conn = 0;
BGP_EVENTS_MAX,
};
+/* BGP finite state machine status. */
+enum bgp_fsm_status {
+ Idle = 1,
+ Connect,
+ Active,
+ OpenSent,
+ OpenConfirm,
+ Established,
+ Clearing,
+ Deleted,
+ BGP_STATUS_MAX,
+};
+
/* BGP neighbor structure. */
struct peer {
/* BGP structure. */
struct peer *doppelganger;
/* Status of the peer. */
- int status;
- int ostatus;
+ enum bgp_fsm_status status;
+ enum bgp_fsm_status ostatus;
/* FSM events, stored for debug purposes.
* Note: uchar used for reduced memory usage.
#define BGP_NOTIFY_CAPABILITY_INVALID_LENGTH 2
#define BGP_NOTIFY_CAPABILITY_MALFORMED_CODE 3
-/* BGP finite state machine status. */
-#define Idle 1
-#define Connect 2
-#define Active 3
-#define OpenSent 4
-#define OpenConfirm 5
-#define Established 6
-#define Clearing 7
-#define Deleted 8
-#define BGP_STATUS_MAX 9
-
/* BGP timers default value. */
#define BGP_INIT_START_TIMER 1
/* The following 3 are RFC defaults that are overridden in bgp_vty.c with