summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2021-09-28 16:02:10 -0500
committerFlorin Coras <florin.coras@gmail.com>2021-09-29 14:42:47 +0000
commitc773a7d5c823e8d804d7c9c52476ca1584843051 (patch)
tree64826a851b5f4850e2016920c892f28ca51d17e9 /src
parente11203e5b8fd61986573e0cba9e47cefcf50e60d (diff)
classify: fix message IDs on API replies
Type: fix When the API cleanup of classify messages was done, the code was not updated to add the message enums to REPLY_MSG_ID_BASE. So the wrong message IDs are being sent back in replies to classify API requests. Add REPLY_MSG_ID_BASE when populated vl_msg_id on a reply. Change-Id: Ic7c828f14d42a346fc58fc9ff062b954f494cdbd Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/classify/classify_api.c75
1 files changed, 42 insertions, 33 deletions
diff --git a/src/vnet/classify/classify_api.c b/src/vnet/classify/classify_api.c
index ccfe8a0ae65..269aac1a194 100644
--- a/src/vnet/classify/classify_api.c
+++ b/src/vnet/classify/classify_api.c
@@ -91,7 +91,8 @@ static void vl_api_classify_pcap_lookup_table_t_handler
out:
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_LOOKUP_TABLE_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_PCAP_LOOKUP_TABLE_REPLY);
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->table_index = htonl (table_index);
@@ -132,7 +133,8 @@ static void vl_api_classify_pcap_set_table_t_handler
out:
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_SET_TABLE_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_PCAP_SET_TABLE_REPLY);
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->table_index = htonl (table_index);
@@ -181,7 +183,8 @@ static void vl_api_classify_pcap_get_tables_t_handler
out:
count = vec_len (tables);
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_PCAP_GET_TABLES_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_PCAP_GET_TABLES_REPLY);
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->count = htonl (count);
@@ -233,7 +236,8 @@ static void vl_api_classify_trace_lookup_table_t_handler
out:
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_LOOKUP_TABLE_REPLY));
+ rmp->_vl_msg_id =
+ ntohs ((REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TRACE_LOOKUP_TABLE_REPLY));
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->table_index = htonl (table_index);
@@ -270,7 +274,8 @@ static void vl_api_classify_trace_set_table_t_handler
out:
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs ((VL_API_CLASSIFY_TRACE_SET_TABLE_REPLY));
+ rmp->_vl_msg_id =
+ ntohs ((REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TRACE_SET_TABLE_REPLY));
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->table_index = htonl (table_index);
@@ -311,7 +316,8 @@ static void vl_api_classify_trace_get_tables_t_handler
out:
count = vec_len (tables);
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TRACE_GET_TABLES_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TRACE_GET_TABLES_REPLY);
rmp->context = mp->context;
rmp->retval = ntohl (rv);
rmp->count = htonl (count);
@@ -469,7 +475,7 @@ send_policer_classify_details (u32 sw_if_index,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_POLICER_CLASSIFY_DETAILS);
+ mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_POLICER_CLASSIFY_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
mp->table_index = htonl (table_index);
@@ -538,7 +544,8 @@ vl_api_classify_table_ids_t_handler (vl_api_classify_table_ids_t * mp)
vl_api_classify_table_ids_reply_t *rmp;
rmp = vl_msg_api_alloc_as_if_client (sizeof (*rmp) + count * sizeof (u32));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_IDS_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TABLE_IDS_REPLY);
rmp->context = mp->context;
rmp->count = ntohl (count);
clib_memcpy (rmp->ids, table_ids, count * sizeof (u32));
@@ -616,34 +623,35 @@ vl_api_classify_table_info_t_handler (vl_api_classify_table_info_t * mp)
u32 table_id = ntohl (mp->table_id);
vnet_classify_table_t *t;
- /* *INDENT-OFF* */
- pool_foreach (t, cm->tables)
+ pool_foreach (t, cm->tables)
{
- if (table_id == t - cm->tables)
- {
- rmp = vl_msg_api_alloc_as_if_client
- (sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
- rmp->context = mp->context;
- rmp->table_id = ntohl(table_id);
- rmp->nbuckets = ntohl(t->nbuckets);
- rmp->match_n_vectors = ntohl(t->match_n_vectors);
- rmp->skip_n_vectors = ntohl(t->skip_n_vectors);
- rmp->active_sessions = ntohl(t->active_elements);
- rmp->next_table_index = ntohl(t->next_table_index);
- rmp->miss_next_index = ntohl(t->miss_next_index);
- rmp->mask_length = ntohl(t->match_n_vectors * sizeof (u32x4));
- clib_memcpy(rmp->mask, t->mask, t->match_n_vectors * sizeof(u32x4));
- rmp->retval = 0;
- break;
- }
- }
- /* *INDENT-ON* */
+ if (table_id == t - cm->tables)
+ {
+ rmp = vl_msg_api_alloc_as_if_client (
+ sizeof (*rmp) + t->match_n_vectors * sizeof (u32x4));
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TABLE_INFO_REPLY);
+ rmp->context = mp->context;
+ rmp->table_id = ntohl (table_id);
+ rmp->nbuckets = ntohl (t->nbuckets);
+ rmp->match_n_vectors = ntohl (t->match_n_vectors);
+ rmp->skip_n_vectors = ntohl (t->skip_n_vectors);
+ rmp->active_sessions = ntohl (t->active_elements);
+ rmp->next_table_index = ntohl (t->next_table_index);
+ rmp->miss_next_index = ntohl (t->miss_next_index);
+ rmp->mask_length = ntohl (t->match_n_vectors * sizeof (u32x4));
+ clib_memcpy (rmp->mask, t->mask,
+ t->match_n_vectors * sizeof (u32x4));
+ rmp->retval = 0;
+ break;
+ }
+ }
if (rmp == 0)
{
rmp = vl_msg_api_alloc (sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_TABLE_INFO_REPLY);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_TABLE_INFO_REPLY);
rmp->context = mp->context;
rmp->retval = ntohl (VNET_API_ERROR_CLASSIFY_TABLE_NOT_FOUND);
}
@@ -661,7 +669,8 @@ send_classify_session_details (vl_api_registration_t * reg,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_CLASSIFY_SESSION_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (REPLY_MSG_ID_BASE + VL_API_CLASSIFY_SESSION_DETAILS);
rmp->context = context;
rmp->table_id = ntohl (table_id);
rmp->hit_next_index = ntohl (e->next_index);
@@ -755,7 +764,7 @@ send_flow_classify_details (u32 sw_if_index,
mp = vl_msg_api_alloc (sizeof (*mp));
clib_memset (mp, 0, sizeof (*mp));
- mp->_vl_msg_id = ntohs (VL_API_FLOW_CLASSIFY_DETAILS);
+ mp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_FLOW_CLASSIFY_DETAILS);
mp->context = context;
mp->sw_if_index = htonl (sw_if_index);
mp->table_index = htonl (table_index);