diff options
author | Donald Sharp <sharpd@nvidia.com> | 2023-08-27 00:07:04 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2023-09-10 14:31:25 +0200 |
commit | d2ba78929f63d49e78140f28995cc745c1c95966 (patch) | |
tree | 71d85bcef551397e7699670cea25fd3744a27a03 /bgpd/bgpd.c | |
parent | bgpd: peer_established should be connection oriented (diff) | |
download | frr-d2ba78929f63d49e78140f28995cc745c1c95966.tar.xz frr-d2ba78929f63d49e78140f28995cc745c1c95966.zip |
bgpd: bgp_fsm_change_status/BGP_TIMER_ON and BGP_EVENT_ADD
Modify bgp_fsm_change_status to be connection oriented and
also make the BGP_TIMER_ON and BGP_EVENT_ADD macros connection
oriented as well. Attempt to make peer_xfer_conn a bit more
understandable because, frankly it was/is confusing.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgpd.c')
-rw-r--r-- | bgpd/bgpd.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 1e83a1fb7..278ab40e1 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -140,7 +140,7 @@ void bgp_session_reset(struct peer *peer) !(CHECK_FLAG(peer->doppelganger->flags, PEER_FLAG_CONFIG_NODE))) peer_delete(peer->doppelganger); - BGP_EVENT_ADD(peer, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Stop); } /* @@ -166,7 +166,7 @@ static void bgp_session_reset_safe(struct peer *peer, struct listnode **nnode) peer_delete(peer->doppelganger); } - BGP_EVENT_ADD(peer, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Stop); } /* BGP global flag manipulation. */ @@ -1208,12 +1208,12 @@ static void peer_free(struct peer *peer) bgp_timer_set(peer->connection); bgp_reads_off(peer->connection); bgp_writes_off(peer->connection); - event_cancel_event_ready(bm->master, peer); + event_cancel_event_ready(bm->master, peer->connection); FOREACH_AFI_SAFI (afi, safi) EVENT_OFF(peer->t_revalidate_all[afi][safi]); assert(!peer->connection->t_write); assert(!peer->connection->t_read); - event_cancel_event_ready(bm->master, peer); + event_cancel_event_ready(bm->master, peer->connection); /* Free connected nexthop, if present */ if (CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE) @@ -2591,7 +2591,7 @@ int peer_delete(struct peer *peer) bgp_keepalives_off(peer->connection); bgp_reads_off(peer->connection); bgp_writes_off(peer->connection); - event_cancel_event_ready(bm->master, peer); + event_cancel_event_ready(bm->master, peer->connection); FOREACH_AFI_SAFI (afi, safi) EVENT_OFF(peer->t_revalidate_all[afi][safi]); assert(!CHECK_FLAG(peer->connection->thread_flags, @@ -2637,7 +2637,7 @@ int peer_delete(struct peer *peer) } UNSET_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER); - bgp_fsm_change_status(peer, Deleted); + bgp_fsm_change_status(peer->connection, Deleted); /* Remove from NHT */ if (CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE)) @@ -3734,7 +3734,7 @@ void bgp_instance_up(struct bgp *bgp) /* Kick off any peers that may have been configured. */ for (ALL_LIST_ELEMENTS(bgp->peer, node, next, peer)) { if (!BGP_PEER_START_SUPPRESSED(peer)) - BGP_EVENT_ADD(peer, BGP_Start); + BGP_EVENT_ADD(peer->connection, BGP_Start); } /* Process any networks that have been configured. */ @@ -4642,7 +4642,7 @@ static void peer_flag_modify_action(struct peer *peer, uint64_t flag) bgp_session_reset(peer); } else { peer->v_start = BGP_INIT_START_TIMER; - BGP_EVENT_ADD(peer, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Stop); } } else if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) { if (flag == PEER_FLAG_DYNAMIC_CAPABILITY) @@ -4706,7 +4706,7 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg) peer->v_start = BGP_INIT_START_TIMER; /* trigger a RFC 4271 ManualStop event */ - BGP_EVENT_ADD(peer, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Stop); } /* set the BGP instances shutdown flag */ @@ -5992,8 +5992,8 @@ int peer_timers_connect_set(struct peer *peer, uint32_t connect) if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { if (!peer_established(peer->connection)) { if (peer_active(peer)) - BGP_EVENT_ADD(peer, BGP_Stop); - BGP_EVENT_ADD(peer, BGP_Start); + BGP_EVENT_ADD(peer->connection, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Start); } return 0; } @@ -6013,8 +6013,8 @@ int peer_timers_connect_set(struct peer *peer, uint32_t connect) if (!peer_established(member->connection)) { if (peer_active(member)) - BGP_EVENT_ADD(member, BGP_Stop); - BGP_EVENT_ADD(member, BGP_Start); + BGP_EVENT_ADD(member->connection, BGP_Stop); + BGP_EVENT_ADD(member->connection, BGP_Start); } } @@ -6046,8 +6046,8 @@ int peer_timers_connect_unset(struct peer *peer) if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) { if (!peer_established(peer->connection)) { if (peer_active(peer)) - BGP_EVENT_ADD(peer, BGP_Stop); - BGP_EVENT_ADD(peer, BGP_Start); + BGP_EVENT_ADD(peer->connection, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Start); } return 0; } @@ -6067,8 +6067,8 @@ int peer_timers_connect_unset(struct peer *peer) if (!peer_established(member->connection)) { if (peer_active(member)) - BGP_EVENT_ADD(member, BGP_Stop); - BGP_EVENT_ADD(member, BGP_Start); + BGP_EVENT_ADD(member->connection, BGP_Stop); + BGP_EVENT_ADD(member->connection, BGP_Start); } } @@ -6505,7 +6505,7 @@ int peer_local_as_unset(struct peer *peer) bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); } else - BGP_EVENT_ADD(peer, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Stop); /* Skip peer-group mechanics for regular peers. */ return 0; @@ -7554,7 +7554,7 @@ static bool peer_maximum_prefix_clear_overflow(struct peer *peer) "%pBP Maximum-prefix restart timer cancelled", peer); } - BGP_EVENT_ADD(peer, BGP_Start); + BGP_EVENT_ADD(peer->connection, BGP_Start); return true; } @@ -8325,8 +8325,8 @@ static int peer_unshut_after_cfg(struct bgp *bgp) if (peer_active(peer) && peer->connection->status != Established) { if (peer->connection->status != Idle) - BGP_EVENT_ADD(peer, BGP_Stop); - BGP_EVENT_ADD(peer, BGP_Start); + BGP_EVENT_ADD(peer->connection, BGP_Stop); + BGP_EVENT_ADD(peer->connection, BGP_Start); } } |