mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 03:28:31 +00:00
bgpd: rename peer_keepalives* --> bgp_keepalives*
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
424ab01d0f
commit
b72b6f4fc9
@ -285,7 +285,7 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
}
|
}
|
||||||
BGP_TIMER_OFF(peer->t_connect);
|
BGP_TIMER_OFF(peer->t_connect);
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
|
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
|
||||||
peer->v_connect);
|
peer->v_connect);
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
peer->v_connect);
|
peer->v_connect);
|
||||||
}
|
}
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
} else {
|
} else {
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
}
|
}
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -341,11 +341,11 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
timer and KeepAlive timers are not started. */
|
timer and KeepAlive timers are not started. */
|
||||||
if (peer->v_holdtime == 0) {
|
if (peer->v_holdtime == 0) {
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
} else {
|
} else {
|
||||||
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
|
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
|
||||||
peer->v_holdtime);
|
peer->v_holdtime);
|
||||||
peer_keepalives_on(peer);
|
bgp_keepalives_on(peer);
|
||||||
}
|
}
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
@ -360,11 +360,11 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
and keepalive must be turned off. */
|
and keepalive must be turned off. */
|
||||||
if (peer->v_holdtime == 0) {
|
if (peer->v_holdtime == 0) {
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
} else {
|
} else {
|
||||||
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
|
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
|
||||||
peer->v_holdtime);
|
peer->v_holdtime);
|
||||||
peer_keepalives_on(peer);
|
bgp_keepalives_on(peer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Deleted:
|
case Deleted:
|
||||||
@ -376,7 +376,7 @@ void bgp_timer_set(struct peer *peer)
|
|||||||
BGP_TIMER_OFF(peer->t_start);
|
BGP_TIMER_OFF(peer->t_start);
|
||||||
BGP_TIMER_OFF(peer->t_connect);
|
BGP_TIMER_OFF(peer->t_connect);
|
||||||
BGP_TIMER_OFF(peer->t_holdtime);
|
BGP_TIMER_OFF(peer->t_holdtime);
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
BGP_TIMER_OFF(peer->t_routeadv);
|
BGP_TIMER_OFF(peer->t_routeadv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1065,7 +1065,7 @@ int bgp_stop(struct peer *peer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* stop keepalives */
|
/* stop keepalives */
|
||||||
peer_keepalives_off(peer);
|
bgp_keepalives_off(peer);
|
||||||
|
|
||||||
/* Stop read and write threads. */
|
/* Stop read and write threads. */
|
||||||
bgp_writes_off(peer);
|
bgp_writes_off(peer);
|
||||||
|
@ -142,7 +142,7 @@ static unsigned int peer_hash_key(void *arg)
|
|||||||
return (uintptr_t)pkat->peer;
|
return (uintptr_t)pkat->peer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_keepalives_init()
|
void bgp_keepalives_init()
|
||||||
{
|
{
|
||||||
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
|
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
|
||||||
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
|
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
|
||||||
@ -161,7 +161,7 @@ void peer_keepalives_init()
|
|||||||
peerhash = hash_create_size(2048, peer_hash_key, peer_hash_cmp);
|
peerhash = hash_create_size(2048, peer_hash_key, peer_hash_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void peer_keepalives_finish(void *arg)
|
static void bgp_keepalives_finish(void *arg)
|
||||||
{
|
{
|
||||||
bgp_keepalives_thread_run = false;
|
bgp_keepalives_thread_run = false;
|
||||||
|
|
||||||
@ -183,9 +183,9 @@ static void peer_keepalives_finish(void *arg)
|
|||||||
/**
|
/**
|
||||||
* Entry function for peer keepalive generation pthread.
|
* Entry function for peer keepalive generation pthread.
|
||||||
*
|
*
|
||||||
* peer_keepalives_init() must be called prior to this.
|
* bgp_keepalives_init() must be called prior to this.
|
||||||
*/
|
*/
|
||||||
void *peer_keepalives_start(void *arg)
|
void *bgp_keepalives_start(void *arg)
|
||||||
{
|
{
|
||||||
struct timeval currtime = {0, 0};
|
struct timeval currtime = {0, 0};
|
||||||
struct timeval aftertime = {0, 0};
|
struct timeval aftertime = {0, 0};
|
||||||
@ -195,7 +195,7 @@ void *peer_keepalives_start(void *arg)
|
|||||||
pthread_mutex_lock(peerhash_mtx);
|
pthread_mutex_lock(peerhash_mtx);
|
||||||
|
|
||||||
// register cleanup handler
|
// register cleanup handler
|
||||||
pthread_cleanup_push(&peer_keepalives_finish, NULL);
|
pthread_cleanup_push(&bgp_keepalives_finish, NULL);
|
||||||
|
|
||||||
bgp_keepalives_thread_run = true;
|
bgp_keepalives_thread_run = true;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ void *peer_keepalives_start(void *arg)
|
|||||||
|
|
||||||
/* --- thread external functions ------------------------------------------- */
|
/* --- thread external functions ------------------------------------------- */
|
||||||
|
|
||||||
void peer_keepalives_on(struct peer *peer)
|
void bgp_keepalives_on(struct peer *peer)
|
||||||
{
|
{
|
||||||
/* placeholder bucket data to use for fast key lookups */
|
/* placeholder bucket data to use for fast key lookups */
|
||||||
static struct pkat holder = {0};
|
static struct pkat holder = {0};
|
||||||
@ -246,10 +246,10 @@ void peer_keepalives_on(struct peer *peer)
|
|||||||
SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
|
SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(peerhash_mtx);
|
pthread_mutex_unlock(peerhash_mtx);
|
||||||
peer_keepalives_wake();
|
bgp_keepalives_wake();
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_keepalives_off(struct peer *peer)
|
void bgp_keepalives_off(struct peer *peer)
|
||||||
{
|
{
|
||||||
/* placeholder bucket data to use for fast key lookups */
|
/* placeholder bucket data to use for fast key lookups */
|
||||||
static struct pkat holder = {0};
|
static struct pkat holder = {0};
|
||||||
@ -267,7 +267,7 @@ void peer_keepalives_off(struct peer *peer)
|
|||||||
pthread_mutex_unlock(peerhash_mtx);
|
pthread_mutex_unlock(peerhash_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void peer_keepalives_wake()
|
void bgp_keepalives_wake()
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(peerhash_mtx);
|
pthread_mutex_lock(peerhash_mtx);
|
||||||
{
|
{
|
||||||
@ -276,10 +276,10 @@ void peer_keepalives_wake()
|
|||||||
pthread_mutex_unlock(peerhash_mtx);
|
pthread_mutex_unlock(peerhash_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int peer_keepalives_stop(void **result, struct frr_pthread *fpt)
|
int bgp_keepalives_stop(void **result, struct frr_pthread *fpt)
|
||||||
{
|
{
|
||||||
bgp_keepalives_thread_run = false;
|
bgp_keepalives_thread_run = false;
|
||||||
peer_keepalives_wake();
|
bgp_keepalives_wake();
|
||||||
pthread_join(fpt->thread, result);
|
pthread_join(fpt->thread, result);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -43,13 +43,13 @@ extern bool bgp_keepalives_thread_run;
|
|||||||
* peer->obuf. This operation is thread-safe with respect to peer->obuf.
|
* peer->obuf. This operation is thread-safe with respect to peer->obuf.
|
||||||
*
|
*
|
||||||
* peer->v_keepalive determines the interval. Changing this value before
|
* peer->v_keepalive determines the interval. Changing this value before
|
||||||
* unregistering this peer with peer_keepalives_off() results in undefined
|
* unregistering this peer with bgp_keepalives_off() results in undefined
|
||||||
* behavior.
|
* behavior.
|
||||||
*
|
*
|
||||||
* If the peer is already registered for keepalives via this function, nothing
|
* If the peer is already registered for keepalives via this function, nothing
|
||||||
* happens.
|
* happens.
|
||||||
*/
|
*/
|
||||||
extern void peer_keepalives_on(struct peer *);
|
extern void bgp_keepalives_on(struct peer *);
|
||||||
|
|
||||||
/* Turns off keepalives for a peer.
|
/* Turns off keepalives for a peer.
|
||||||
*
|
*
|
||||||
@ -57,25 +57,25 @@ extern void peer_keepalives_on(struct peer *);
|
|||||||
*
|
*
|
||||||
* If the peer is already unregistered for keepalives, nothing happens.
|
* If the peer is already unregistered for keepalives, nothing happens.
|
||||||
*/
|
*/
|
||||||
extern void peer_keepalives_off(struct peer *);
|
extern void bgp_keepalives_off(struct peer *);
|
||||||
|
|
||||||
/* Pre-run initialization function for keepalives pthread.
|
/* Pre-run initialization function for keepalives pthread.
|
||||||
*
|
*
|
||||||
* Initializes synchronization primitives. This should be called before
|
* Initializes synchronization primitives. This should be called before
|
||||||
* anything else to avoid race conditions.
|
* anything else to avoid race conditions.
|
||||||
*/
|
*/
|
||||||
extern void peer_keepalives_init(void);
|
extern void bgp_keepalives_init(void);
|
||||||
|
|
||||||
/* Entry function for keepalives pthread.
|
/* Entry function for keepalives pthread.
|
||||||
*
|
*
|
||||||
* This function loops over an internal list of peers, generating keepalives at
|
* This function loops over an internal list of peers, generating keepalives at
|
||||||
* regular intervals as determined by each peer's keepalive timer.
|
* regular intervals as determined by each peer's keepalive timer.
|
||||||
*
|
*
|
||||||
* See peer_keepalives_on() for additional details.
|
* See bgp_keepalives_on() for additional details.
|
||||||
*
|
*
|
||||||
* @param arg pthread arg, not used
|
* @param arg pthread arg, not used
|
||||||
*/
|
*/
|
||||||
extern void *peer_keepalives_start(void *arg);
|
extern void *bgp_keepalives_start(void *arg);
|
||||||
|
|
||||||
/* Poking function for keepalives pthread.
|
/* Poking function for keepalives pthread.
|
||||||
*
|
*
|
||||||
@ -84,11 +84,11 @@ extern void *peer_keepalives_start(void *arg);
|
|||||||
* thread to wake up and see if there is any work to do, or if it is time to
|
* thread to wake up and see if there is any work to do, or if it is time to
|
||||||
* die.
|
* die.
|
||||||
*
|
*
|
||||||
* It is not necessary to call this after peer_keepalives_on().
|
* It is not necessary to call this after bgp_keepalives_on().
|
||||||
*/
|
*/
|
||||||
extern void peer_keepalives_wake(void);
|
extern void bgp_keepalives_wake(void);
|
||||||
|
|
||||||
/* stop function */
|
/* stop function */
|
||||||
int peer_keepalives_stop(void **result, struct frr_pthread *fpt);
|
int bgp_keepalives_stop(void **result, struct frr_pthread *fpt);
|
||||||
|
|
||||||
#endif /* _BGP_KEEPALIVES_H */
|
#endif /* _BGP_KEEPALIVES_H */
|
||||||
|
@ -7407,10 +7407,10 @@ void bgp_pthreads_init()
|
|||||||
frr_pthread_new("BGP i/o thread", PTHREAD_IO, bgp_io_start,
|
frr_pthread_new("BGP i/o thread", PTHREAD_IO, bgp_io_start,
|
||||||
bgp_io_stop);
|
bgp_io_stop);
|
||||||
frr_pthread_new("BGP keepalives thread", PTHREAD_KEEPALIVES,
|
frr_pthread_new("BGP keepalives thread", PTHREAD_KEEPALIVES,
|
||||||
peer_keepalives_start, peer_keepalives_stop);
|
bgp_keepalives_start, bgp_keepalives_stop);
|
||||||
|
|
||||||
/* pre-run initialization */
|
/* pre-run initialization */
|
||||||
peer_keepalives_init();
|
bgp_keepalives_init();
|
||||||
bgp_io_init();
|
bgp_io_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user