aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/tracedump
diff options
context:
space:
mode:
authorArthur de Kerhor <arthurdekerhor@gmail.com>2022-12-22 19:48:05 +0100
committerArthur de Kerhor <arthurdekerhor@gmail.com>2022-12-22 19:48:05 +0100
commitb89db0cf75a5fe2768b7ef53fac2efb8c4b84ca0 (patch)
treea253a62d38f492cedb7544cf6c49683be0dfa946 /src/plugins/tracedump
parent413447451e3f842815f45bae5d3cd3f87a0876e5 (diff)
misc: fix crash using tracedump plugin with socket API clients
Type: fix Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Change-Id: I208724a515c9a38c4032f101bdf73aa87b1c13be
Diffstat (limited to 'src/plugins/tracedump')
-rw-r--r--src/plugins/tracedump/tracedump.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/tracedump/tracedump.c b/src/plugins/tracedump/tracedump.c
index 17b9a423b53..0f1612c70cd 100644
--- a/src/plugins/tracedump/tracedump.c
+++ b/src/plugins/tracedump/tracedump.c
@@ -213,12 +213,15 @@ vl_api_trace_dump_t_handler (vl_api_trace_dump_t * mp)
iterator_position = clib_net_to_host_u32 (mp->position);
max_records = clib_net_to_host_u32 (mp->max_records);
- /* Don't overflow the existing queue space. */
- svm_queue_t *q = rp->vl_input_queue;
- u32 queue_slots_available = q->maxsize - q->cursize;
- int chunk = (queue_slots_available > 0) ? queue_slots_available - 1 : 0;
- if (chunk < max_records)
- max_records = chunk;
+ /* Don't overflow the existing queue space for shared memory API clients. */
+ if (rp->vl_input_queue)
+ {
+ svm_queue_t *q = rp->vl_input_queue;
+ u32 queue_slots_available = q->maxsize - q->cursize;
+ int chunk = (queue_slots_available > 0) ? queue_slots_available - 1 : 0;
+ if (chunk < max_records)
+ max_records = chunk;
+ }
/* Need a fresh cache for this client? */
if (vec_len (client_trace_cache) == 0