aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nsh
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-04-10 09:44:23 +0200
committerDave Wallace <dwallacelf@gmail.com>2019-04-10 13:06:45 +0000
commit2e1c8967faf4e9f7b45471df02e4e5b07fbb520a (patch)
tree172579d8d04927851d1781262bd2483fa9bf8643 /src/plugins/nsh
parent13464f323a8bbd530bd85256de1c033781e098a7 (diff)
API: Fix shared memory only action handlers.
Some API action handlers called vl_msg_ai_send_shmem() directly. That breaks Unix domain socket API transport. A couple (bond / vhost) also tried to send a sw_interface_event directly, but did not send the message to all that had registred interest. That scheme never worked correctly. Refactored and improved the interface event code. Change-Id: Idb90edfd8703c6ae593b36b4eeb4d3ed7da5c808 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/plugins/nsh')
-rw-r--r--src/plugins/nsh/nsh_api.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/plugins/nsh/nsh_api.c b/src/plugins/nsh/nsh_api.c
index cf9fd574b34..e541301614b 100644
--- a/src/plugins/nsh/nsh_api.c
+++ b/src/plugins/nsh/nsh_api.c
@@ -124,7 +124,7 @@ VNET_DEVICE_CLASS (nsh_device_class, static) = {
/* *INDENT-ON* */
static void send_nsh_entry_details
- (nsh_entry_t * t, unix_shared_memory_queue_t * q, u32 context)
+ (nsh_entry_t * t, vl_api_registration_t * rp, u32 context)
{
vl_api_nsh_entry_details_t *rmp;
nsh_main_t *nm = &nsh_main;
@@ -157,11 +157,11 @@ static void send_nsh_entry_details
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (rp, (u8 *) rmp);
}
static void send_nsh_map_details
- (nsh_map_t * t, unix_shared_memory_queue_t * q, u32 context)
+ (nsh_map_t * t, vl_api_registration_t * rp, u32 context)
{
vl_api_nsh_map_details_t *rmp;
nsh_main_t *nm = &nsh_main;
@@ -179,22 +179,20 @@ static void send_nsh_map_details
rmp->context = context;
- vl_msg_api_send_shmem (q, (u8 *) & rmp);
+ vl_api_send_msg (rp, (u8 *) rmp);
}
static void
vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
nsh_main_t *nm = &nsh_main;
nsh_map_t *t;
u32 map_index;
+ vl_api_registration_t *rp;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ rp = vl_api_client_index_to_registration (mp->client_index);
+ if (rp == 0)
+ return;
map_index = ntohl (mp->map_index);
@@ -202,7 +200,7 @@ vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp)
{
pool_foreach (t, nm->nsh_mappings, (
{
- send_nsh_map_details (t, q,
+ send_nsh_map_details (t, rp,
mp->context);
}
));
@@ -214,7 +212,7 @@ vl_api_nsh_map_dump_t_handler (vl_api_nsh_map_dump_t * mp)
return;
}
t = &nm->nsh_mappings[map_index];
- send_nsh_map_details (t, q, mp->context);
+ send_nsh_map_details (t, rp, mp->context);
}
}
@@ -650,16 +648,14 @@ static void vl_api_nsh_add_del_entry_t_handler
static void
vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp)
{
- unix_shared_memory_queue_t *q;
nsh_main_t *nm = &nsh_main;
nsh_entry_t *t;
u32 entry_index;
+ vl_api_registration_t *rp;
- q = vl_api_client_index_to_input_queue (mp->client_index);
- if (q == 0)
- {
- return;
- }
+ rp = vl_api_client_index_to_registration (mp->client_index);
+ if (rp == 0)
+ return;
entry_index = ntohl (mp->entry_index);
@@ -667,7 +663,7 @@ vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp)
{
pool_foreach (t, nm->nsh_entries, (
{
- send_nsh_entry_details (t, q,
+ send_nsh_entry_details (t, rp,
mp->context);
}
));
@@ -679,7 +675,7 @@ vl_api_nsh_entry_dump_t_handler (vl_api_nsh_entry_dump_t * mp)
return;
}
t = &nm->nsh_entries[entry_index];
- send_nsh_entry_details (t, q, mp->context);
+ send_nsh_entry_details (t, rp, mp->context);
}
}