summaryrefslogtreecommitdiffstats
path: root/src/vnet/map/map_api.c
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2017-06-26 18:12:37 +0200
committerOle Troan <ot@cisco.com>2017-06-26 19:49:36 +0200
commitc08b0965d73da57ca4cd6c9dcfca1abaca870578 (patch)
treea356c3b5f6858c22f41775bc938891afd07d31ee /src/vnet/map/map_api.c
parent04ffd0ad83b2d87edb669a9d76eee85f5c589564 (diff)
VPP-889: MAP Stats API/CLI crashes when no domains.
Change-Id: Ib7824bfc08cb3c8f20258379e1a1f2c159c4f687 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vnet/map/map_api.c')
-rw-r--r--src/vnet/map/map_api.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vnet/map/map_api.c b/src/vnet/map/map_api.c
index d618e7a65bf..994a64de480 100644
--- a/src/vnet/map/map_api.c
+++ b/src/vnet/map/map_api.c
@@ -203,6 +203,12 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp)
rmp->context = mp->context;
rmp->retval = 0;
+ if (pool_elts (mm->domains) == 0)
+ {
+ rmp->retval = -1;
+ goto out;
+ }
+
memset (total_pkts, 0, sizeof (total_pkts));
memset (total_bytes, 0, sizeof (total_bytes));
@@ -239,6 +245,7 @@ vl_api_map_summary_stats_t_handler (vl_api_map_summary_stats_t * mp)
clib_host_to_net_u64 (map_error_counter_get
(ip4_map_node.index, MAP_ERROR_DECAP_SEC_CHECK));
+out:
vl_msg_api_send_shmem (q, (u8 *) & rmp);
}