From: Quentin Young Date: Wed, 24 Jan 2018 22:47:17 +0000 (-0500) Subject: bgpd: check flags before attempting keepalive ops X-Git-Tag: frr-4.0-dev~22^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F1672%2Fhead;p=mirror%2Ffrr.git 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 --- 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);