From 2e1c8967faf4e9f7b45471df02e4e5b07fbb520a Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Wed, 10 Apr 2019 09:44:23 +0200 Subject: 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 --- src/plugins/igmp/igmp_api.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/plugins/igmp') diff --git a/src/plugins/igmp/igmp_api.c b/src/plugins/igmp/igmp_api.c index 0149b2af127..d619abdd893 100644 --- a/src/plugins/igmp/igmp_api.c +++ b/src/plugins/igmp/igmp_api.c @@ -160,7 +160,7 @@ static void } static void -send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im, +send_igmp_details (vl_api_registration_t * rp, igmp_main_t * im, igmp_config_t * config, igmp_group_t * group, igmp_src_t * src, u32 context) { @@ -175,12 +175,12 @@ send_igmp_details (unix_shared_memory_queue_t * q, igmp_main_t * im, clib_memcpy (&mp->saddr, &src->key->ip4, sizeof (src->key->ip4)); clib_memcpy (&mp->gaddr, &group->key->ip4, sizeof (group->key->ip4)); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (rp, (u8 *) mp); } static void igmp_config_dump (igmp_main_t * im, - unix_shared_memory_queue_t * q, + vl_api_registration_t * rp, u32 context, igmp_config_t * config) { igmp_group_t *group; @@ -191,7 +191,7 @@ igmp_config_dump (igmp_main_t * im, ({ FOR_EACH_SRC (src, group, IGMP_FILTER_MODE_INCLUDE, ({ - send_igmp_details (q, im, config, group, src, context); + send_igmp_details (rp, im, config, group, src, context); })); })); /* *INDENT-ON* */ @@ -200,13 +200,13 @@ igmp_config_dump (igmp_main_t * im, static void vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) { - unix_shared_memory_queue_t *q; igmp_main_t *im = &igmp_main; igmp_config_t *config; u32 sw_if_index; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; sw_if_index = ntohl (mp->sw_if_index); @@ -215,7 +215,7 @@ vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) /* *INDENT-OFF* */ pool_foreach (config, im->configs, ({ - igmp_config_dump(im, q, mp->context, config); + igmp_config_dump(im, rp, mp->context, config); })); /* *INDENT-ON* */ } @@ -224,7 +224,7 @@ vl_api_igmp_dump_t_handler (vl_api_igmp_dump_t * mp) config = igmp_config_lookup (sw_if_index); if (config) { - igmp_config_dump (im, q, mp->context, config); + igmp_config_dump (im, rp, mp->context, config); } } } @@ -286,7 +286,7 @@ vl_api_igmp_group_prefix_set_t_handler (vl_api_igmp_group_prefix_set_t * mp) typedef struct igmp_ssm_range_walk_ctx_t_ { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; u32 context; } igmp_ssm_range_walk_ctx_t; @@ -305,7 +305,7 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx, mp->gp.type = igmp_group_type_int_to_api (type); ip_prefix_encode (pfx, &mp->gp.prefix); - vl_msg_api_send_shmem (ctx->q, (u8 *) & mp); + vl_api_send_msg (ctx->rp, (u8 *) mp); return (WALK_CONTINUE); } @@ -313,14 +313,14 @@ igmp_ssm_range_walk_dump (const fib_prefix_t * pfx, static void vl_api_igmp_group_prefix_dump_t_handler (vl_api_igmp_dump_t * mp) { - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; - q = vl_api_client_index_to_input_queue (mp->client_index); - if (!q) + rp = vl_api_client_index_to_registration (mp->client_index); + if (rp == 0) return; igmp_ssm_range_walk_ctx_t ctx = { - .q = q, + .rp = rp, .context = mp->context, }; @@ -398,7 +398,7 @@ want_igmp_events_reaper (u32 client_index) VL_MSG_API_REAPER_FUNCTION (want_igmp_events_reaper); void -send_igmp_event (unix_shared_memory_queue_t * q, +send_igmp_event (vl_api_registration_t * rp, u32 context, igmp_filter_mode_t filter, u32 sw_if_index, @@ -414,7 +414,7 @@ send_igmp_event (unix_shared_memory_queue_t * q, clib_memcpy (&mp->saddr, &saddr->ip4, sizeof (ip4_address_t)); clib_memcpy (&mp->gaddr, &gaddr->ip4, sizeof (ip4_address_t)); - vl_msg_api_send_shmem (q, (u8 *) & mp); + vl_api_send_msg (rp, (u8 *) mp); } void @@ -423,7 +423,7 @@ igmp_event (igmp_filter_mode_t filter, const ip46_address_t * saddr, const ip46_address_t * gaddr) { vpe_client_registration_t *api_client; - unix_shared_memory_queue_t *q; + vl_api_registration_t *rp; igmp_main_t *im; im = &igmp_main; @@ -438,9 +438,9 @@ igmp_event (igmp_filter_mode_t filter, /* *INDENT-OFF* */ pool_foreach (api_client, im->api_clients, ({ - q = vl_api_client_index_to_input_queue (api_client->client_index); - if (q) - send_igmp_event (q, 0, filter, sw_if_index, saddr, gaddr); + rp = vl_api_client_index_to_registration (api_client->client_index); + if (rp) + send_igmp_event (rp, 0, filter, sw_if_index, saddr, gaddr); })); /* *INDENT-ON* */ } -- cgit 1.2.3-korg