From 096476ddb09fd7bf8946c5429bd9903dd33f3d78 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Wed, 24 Jan 2018 17:47:17 -0500 Subject: [PATCH] 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 --- bgpd/bgp_keepalives.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c index a6976109a8..5a48c7013e 100644 --- a/bgpd/bgp_keepalives.c +++ b/bgpd/bgp_keepalives.c @@ -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); -- 2.39.5