bgpd: check flags before attempting keepalive ops

If a peer already has keepalives turned on when asking to turn them on,
return immediately. Same thing for turning them off.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-01-24 17:47:17 -05:00
parent cadc5f3377
commit 096476ddb0
No known key found for this signature in database
GPG Key ID: DAF48E0F57E0834F

View File

@ -224,6 +224,9 @@ void *bgp_keepalives_start(void *arg)
void bgp_keepalives_on(struct peer *peer)
{
if (CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON))
return;
struct frr_pthread *fpt = frr_pthread_get(PTHREAD_KEEPALIVES);
assert(fpt->running);
@ -251,6 +254,9 @@ void bgp_keepalives_on(struct peer *peer)
void bgp_keepalives_off(struct peer *peer)
{
if (!CHECK_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON))
return;
struct frr_pthread *fpt = frr_pthread_get(PTHREAD_KEEPALIVES);
assert(fpt->running);