summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_keepalives.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-11-13 23:59:04 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-11-30 22:18:07 +0100
commit934af4587f0b7ddbfc176c3930c04cca949743ba (patch)
tree1b19c6ad23dfe27bbf5f9ecc7e03307bc94a70a6 /bgpd/bgp_keepalives.c
parentbgpd: yield more when generating UPDATEs (diff)
downloadfrr-934af4587f0b7ddbfc176c3930c04cca949743ba.tar.xz
frr-934af4587f0b7ddbfc176c3930c04cca949743ba.zip
bgpd: turn off keepalives when sending NOTIFY
This is necessary because otherwise between the time we wipe the output buffer and the time we push the NOTIFY onto it, the KA generation thread could have pushed a KEEPALIVE in the middle. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_keepalives.c')
-rw-r--r--bgpd/bgp_keepalives.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c
index abe9739c9..afa280a79 100644
--- a/bgpd/bgp_keepalives.c
+++ b/bgpd/bgp_keepalives.c
@@ -232,6 +232,11 @@ void bgp_keepalives_on(struct peer *peer)
/* placeholder bucket data to use for fast key lookups */
static struct pkat holder = {0};
+ if (!peerhash_mtx) {
+ zlog_warn("%s: call bgp_keepalives_init() first", __func__);
+ return;
+ }
+
pthread_mutex_lock(peerhash_mtx);
{
holder.peer = peer;
@@ -251,6 +256,11 @@ void bgp_keepalives_off(struct peer *peer)
/* placeholder bucket data to use for fast key lookups */
static struct pkat holder = {0};
+ if (!peerhash_mtx) {
+ zlog_warn("%s: call bgp_keepalives_init() first", __func__);
+ return;
+ }
+
pthread_mutex_lock(peerhash_mtx);
{
holder.peer = peer;