2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-01-06 00:13:16 +01:00
|
|
|
/* BGP Keepalives.
|
2017-06-09 21:22:34 +02:00
|
|
|
* Implements a producer thread to generate BGP keepalives for peers.
|
2017-01-06 00:13:16 +01:00
|
|
|
* Copyright (C) 2017 Cumulus Networks, Inc.
|
2017-06-09 21:22:34 +02:00
|
|
|
* Quentin Young
|
2017-01-06 00:13:16 +01:00
|
|
|
*/
|
2017-06-09 21:22:34 +02:00
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
#ifndef _FRR_BGP_KEEPALIVES_H
|
|
|
|
#define _FRR_BGP_KEEPALIVES_H
|
2017-01-06 00:13:16 +01:00
|
|
|
|
2017-05-02 02:37:45 +02:00
|
|
|
#include "frr_pthread.h"
|
2017-01-06 00:13:16 +01:00
|
|
|
#include "bgpd.h"
|
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
/**
|
|
|
|
* Turns on keepalives for a peer.
|
2017-01-06 00:13:16 +01:00
|
|
|
*
|
|
|
|
* This function adds the peer to an internal list of peers to generate
|
|
|
|
* keepalives for.
|
|
|
|
*
|
|
|
|
* At set intervals, a BGP KEEPALIVE packet is generated and placed on
|
|
|
|
* peer->obuf. This operation is thread-safe with respect to peer->obuf.
|
|
|
|
*
|
|
|
|
* peer->v_keepalive determines the interval. Changing this value before
|
2017-05-12 05:54:18 +02:00
|
|
|
* unregistering this peer with bgp_keepalives_off() results in undefined
|
2017-01-06 00:13:16 +01:00
|
|
|
* behavior.
|
|
|
|
*
|
|
|
|
* If the peer is already registered for keepalives via this function, nothing
|
|
|
|
* happens.
|
|
|
|
*/
|
2023-08-27 03:34:59 +02:00
|
|
|
extern void bgp_keepalives_on(struct peer_connection *connection);
|
2017-01-06 00:13:16 +01:00
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
/**
|
|
|
|
* Turns off keepalives for a peer.
|
2017-01-06 00:13:16 +01:00
|
|
|
*
|
|
|
|
* Removes the peer from the internal list of peers to generate keepalives for.
|
|
|
|
*
|
|
|
|
* If the peer is already unregistered for keepalives, nothing happens.
|
|
|
|
*/
|
2023-08-27 03:34:59 +02:00
|
|
|
extern void bgp_keepalives_off(struct peer_connection *connection);
|
2017-01-06 00:13:16 +01:00
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
/**
|
|
|
|
* Pre-run initialization function for keepalives pthread.
|
2017-03-29 21:16:28 +02:00
|
|
|
*
|
|
|
|
* Initializes synchronization primitives. This should be called before
|
|
|
|
* anything else to avoid race conditions.
|
|
|
|
*/
|
2017-05-12 05:54:18 +02:00
|
|
|
extern void bgp_keepalives_init(void);
|
2017-03-29 21:16:28 +02:00
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
/**
|
|
|
|
* Entry function for keepalives pthread.
|
2017-01-06 00:13:16 +01:00
|
|
|
*
|
|
|
|
* This function loops over an internal list of peers, generating keepalives at
|
|
|
|
* regular intervals as determined by each peer's keepalive timer.
|
|
|
|
*
|
2017-05-12 05:54:18 +02:00
|
|
|
* See bgp_keepalives_on() for additional details.
|
2017-01-06 00:13:16 +01:00
|
|
|
*
|
|
|
|
* @param arg pthread arg, not used
|
|
|
|
*/
|
2017-05-12 05:54:18 +02:00
|
|
|
extern void *bgp_keepalives_start(void *arg);
|
2017-01-06 00:13:16 +01:00
|
|
|
|
2017-06-09 21:22:34 +02:00
|
|
|
/**
|
|
|
|
* Stops the thread and blocks until it terminates.
|
|
|
|
*/
|
2018-01-24 17:07:27 +01:00
|
|
|
int bgp_keepalives_stop(struct frr_pthread *fpt, void **result);
|
2017-04-16 07:18:07 +02:00
|
|
|
|
2017-09-08 17:51:12 +02:00
|
|
|
#endif /* _FRR_BGP_KEEPALIVES_H */
|