]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_keepalives.c
Merge pull request #5686 from qlyoung/fix-bgp-fqdn-capability-leak
[mirror_frr.git] / bgpd / bgp_keepalives.c
index 6de1c216a65b4bc155061ab3978bd4544dfafcdd..3a5adae8748091c6ba940497e23788934147fbb2 100644 (file)
@@ -95,13 +95,20 @@ static void peer_process(struct hash_bucket *hb, void *arg)
        static struct timeval ka = {0}; // peer->v_keepalive as a timeval
        static struct timeval diff;     // ka - elapsed
 
-       static struct timeval tolerance = {0, 100000};
+       static const 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 =