summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorSubbaiah Venkata <svenkata@google.com>2012-03-27 16:35:22 -0700
committerAvneesh Sachdev <avneesh@opensourcerouting.org>2012-04-07 23:52:40 -0700
commitfc328ac9d3d49b871c1139f36deb702a254c0d4f (patch)
treea7189a1286862a347834792e93a7b00df3c0cfac /zebra/zebra_rib.c
parente38e0df01ad305ad48ecf816b52fa99fd3f2a4e1 (diff)
zebra: add more logs/asserts to rib work queue code
* zebra/zebra_rib.c: (rib_queue_add, rib_queue_init) Add some more logs and asserts. From: Subbaiah Venkata <svenkata@google.com> Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org> Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 580b75bb..0035eb6e 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1271,14 +1271,30 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
static void
rib_queue_add (struct zebra_t *zebra, struct route_node *rn)
{
+ char buf[INET_ADDRSTRLEN];
+ assert (zebra && rn);
if (IS_ZEBRA_DEBUG_RIB_Q)
+ inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN);
+
+ /* Pointless to queue a route_node with no RIB entries to add or remove */
+ if (!rn->info)
{
- char buf[INET6_ADDRSTRLEN];
+ zlog_debug ("%s: called for route_node (%p, %d) with no ribs",
+ __func__, rn, rn->lock);
+ zlog_backtrace(LOG_DEBUG);
+ return;
+ }
- zlog_info ("%s: %s/%d: work queue added", __func__,
- inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN),
- rn->p.prefixlen);
+ if (IS_ZEBRA_DEBUG_RIB_Q)
+ zlog_info ("%s: %s/%d: work queue added", __func__, buf, rn->p.prefixlen);
+
+ assert (zebra);
+
+ if (zebra->ribq == NULL)
+ {
+ zlog_err ("%s: work_queue does not exist!", __func__);
+ return;
}
/*
@@ -1293,6 +1309,11 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn)
work_queue_add (zebra->ribq, zebra->mq);
rib_meta_queue_add (zebra->mq, rn);
+
+ if (IS_ZEBRA_DEBUG_RIB_Q)
+ zlog_debug ("%s: %s/%d: rn %p queued", __func__, buf, rn->p.prefixlen, rn);
+
+ return;
}
/* Create new meta queue.
@@ -1320,6 +1341,8 @@ meta_queue_new (void)
static void
rib_queue_init (struct zebra_t *zebra)
{
+ assert (zebra);
+
if (! (zebra->ribq = work_queue_new (zebra->master,
"route_node processing")))
{
@@ -1335,7 +1358,11 @@ rib_queue_init (struct zebra_t *zebra)
zebra->ribq->spec.hold = rib_process_hold_time;
if (!(zebra->mq = meta_queue_new ()))
+ {
zlog_err ("%s: could not initialise meta queue!", __func__);
+ return;
+ }
+ return;
}
/* RIB updates are processed via a queue of pointers to route_nodes.