summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_keepalives.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-08-16 02:44:31 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-08-16 14:24:22 +0200
commit68ede9c40127bfd3e098fa11da32bbdaae75f908 (patch)
tree63a0ef4a08021cda67884a3641ff9c809c0b3ada /bgpd/bgp_keepalives.c
parentbgpd: Convert warn to debug (diff)
downloadfrr-68ede9c40127bfd3e098fa11da32bbdaae75f908.tar.xz
frr-68ede9c40127bfd3e098fa11da32bbdaae75f908.zip
bgpd: zlog_warn to assert for code that must be executed first
In bgp_keepalives.c, it was noticed that we were ensuring that we called an intialization function first, but this is a development escape in that once this was fixed we never see it. So if a developer moves this assumption around, let's crash the program and lead them to this spot instead of silently ignoring the problem. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_keepalives.c')
-rw-r--r--bgpd/bgp_keepalives.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bgpd/bgp_keepalives.c b/bgpd/bgp_keepalives.c
index 3216683a5..f81836cc8 100644
--- a/bgpd/bgp_keepalives.c
+++ b/bgpd/bgp_keepalives.c
@@ -239,10 +239,10 @@ 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;
- }
+ /*
+ * We need to ensure that bgp_keepalives_init was called first
+ */
+ assert(peerhash_mtx);
pthread_mutex_lock(peerhash_mtx);
{
@@ -269,10 +269,10 @@ 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;
- }
+ /*
+ * We need to ensure that bgp_keepalives_init was called first
+ */
+ assert(peerhash_mtx);
pthread_mutex_lock(peerhash_mtx);
{