}
BGP_TIMER_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
BGP_TIMER_ON(peer->t_connect, bgp_connect_timer,
peer->v_connect);
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
peer->v_connect);
}
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
} else {
BGP_TIMER_OFF(peer->t_holdtime);
}
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
timer and KeepAlive timers are not started. */
if (peer->v_holdtime == 0) {
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
} else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime);
- peer_keepalives_on(peer);
+ bgp_keepalives_on(peer);
}
BGP_TIMER_OFF(peer->t_routeadv);
break;
and keepalive must be turned off. */
if (peer->v_holdtime == 0) {
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
} else {
BGP_TIMER_ON(peer->t_holdtime, bgp_holdtime_timer,
peer->v_holdtime);
- peer_keepalives_on(peer);
+ bgp_keepalives_on(peer);
}
break;
case Deleted:
BGP_TIMER_OFF(peer->t_start);
BGP_TIMER_OFF(peer->t_connect);
BGP_TIMER_OFF(peer->t_holdtime);
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
BGP_TIMER_OFF(peer->t_routeadv);
break;
}
}
/* stop keepalives */
- peer_keepalives_off(peer);
+ bgp_keepalives_off(peer);
/* Stop read and write threads. */
bgp_writes_off(peer);
return (uintptr_t)pkat->peer;
}
-void peer_keepalives_init()
+void bgp_keepalives_init()
{
peerhash_mtx = XCALLOC(MTYPE_TMP, sizeof(pthread_mutex_t));
peerhash_cond = XCALLOC(MTYPE_TMP, sizeof(pthread_cond_t));
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;
/**
* 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 aftertime = {0, 0};
pthread_mutex_lock(peerhash_mtx);
// register cleanup handler
- pthread_cleanup_push(&peer_keepalives_finish, NULL);
+ pthread_cleanup_push(&bgp_keepalives_finish, NULL);
bgp_keepalives_thread_run = true;
/* --- 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 */
static struct pkat holder = {0};
SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
}
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 */
static struct pkat holder = {0};
pthread_mutex_unlock(peerhash_mtx);
}
-void peer_keepalives_wake()
+void bgp_keepalives_wake()
{
pthread_mutex_lock(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;
- peer_keepalives_wake();
+ bgp_keepalives_wake();
pthread_join(fpt->thread, result);
return 0;
}
* peer->obuf. This operation is thread-safe with respect to peer->obuf.
*
* 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.
*
* If the peer is already registered for keepalives via this function, nothing
* happens.
*/
-extern void peer_keepalives_on(struct peer *);
+extern void bgp_keepalives_on(struct peer *);
/* Turns off keepalives for a peer.
*
*
* 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.
*
* Initializes synchronization primitives. This should be called before
* anything else to avoid race conditions.
*/
-extern void peer_keepalives_init(void);
+extern void bgp_keepalives_init(void);
/* Entry function for keepalives pthread.
*
* This function loops over an internal list of peers, generating keepalives at
* 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
*/
-extern void *peer_keepalives_start(void *arg);
+extern void *bgp_keepalives_start(void *arg);
/* Poking function for keepalives pthread.
*
* thread to wake up and see if there is any work to do, or if it is time to
* 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 */
-int peer_keepalives_stop(void **result, struct frr_pthread *fpt);
+int bgp_keepalives_stop(void **result, struct frr_pthread *fpt);
#endif /* _BGP_KEEPALIVES_H */
frr_pthread_new("BGP i/o thread", PTHREAD_IO, bgp_io_start,
bgp_io_stop);
frr_pthread_new("BGP keepalives thread", PTHREAD_KEEPALIVES,
- peer_keepalives_start, peer_keepalives_stop);
+ bgp_keepalives_start, bgp_keepalives_stop);
/* pre-run initialization */
- peer_keepalives_init();
+ bgp_keepalives_init();
bgp_io_init();
}