Skip to content

Commit

Permalink
Merge pull request #4986 from qlyoung/fix-bgp-zero-keepalive-timer-7.2
Browse files Browse the repository at this point in the history
[7.2] bgpd: do not send keepalives when KA timer is 0
  • Loading branch information
srimohans committed Sep 16, 2019
2 parents 4de6689 + d8e2b28 commit dfbca14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bgpd/bgp_keepalives.c
Expand Up @@ -97,11 +97,18 @@ static void peer_process(struct hash_bucket *hb, void *arg)

static struct timeval tolerance = {0, 100000};

uint32_t v_ka = atomic_load_explicit(&pkat->peer->v_keepalive,
memory_order_relaxed);

/* 0 keepalive timer means no keepalives */
if (v_ka == 0)
return;

/* calculate elapsed time since last keepalive */
monotime_since(&pkat->last, &elapsed);

/* calculate difference between elapsed time and configured time */
ka.tv_sec = pkat->peer->v_keepalive;
ka.tv_sec = v_ka;
timersub(&ka, &elapsed, &diff);

int send_keepalive =
Expand Down

0 comments on commit dfbca14

Please sign in to comment.