Fix session connect_* api message handling.
Change-Id: If7fd125989c90240de12953658d10007b9eb4f07 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
This commit is contained in:
committed by
Florin Coras
parent
4830414138
commit
33e002b168
@@ -1,10 +1,10 @@
|
||||
echo \n\n====== gdb_cmdfile.vppcom_client ======\n
|
||||
echo \n\n====== gdb_cmdfile.vcl_client ======\n
|
||||
|
||||
# Here are some interesting vppcom breakpoints...
|
||||
# Here are some interesting VCL breakpoints...
|
||||
# Uncomment them out to set during gdb init.
|
||||
#
|
||||
#b vppcom_session_connect
|
||||
#b vppcom_session_write
|
||||
#b vppcom_session_read
|
||||
#b vl_api_connect_sock_t_handler
|
||||
#b vl_api_connect_sock_reply_t_handler
|
||||
#b vl_api_connect_session_reply_t_handler
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
echo \n\n====== gdb_cmdfile.vppcom_server ======\n
|
||||
echo \n\n====== gdb_cmdfile.vcl_server ======\n
|
||||
|
||||
# Here are some interesting vppcom breakpoints...
|
||||
# Here are some interesting VCL breakpoints...
|
||||
# Uncomment them out to set during gdb init.
|
||||
#
|
||||
#b vppcom_session_accept
|
||||
#b vppcom_session_write
|
||||
#b vppcom_session_read
|
||||
#b vl_api_connect_sock_t_handler
|
||||
#b vl_api_connect_sock_reply_t_handler
|
||||
#b vl_api_connect_session_reply_t_handler
|
||||
|
||||
@@ -345,7 +345,7 @@ main (int argc, char **argv)
|
||||
memset (&servaddr, 0, sizeof (servaddr));
|
||||
|
||||
servaddr.sin_family = AF_INET;
|
||||
servaddr.sin_addr.s_addr = htons (INADDR_ANY);
|
||||
servaddr.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
servaddr.sin_port = htons (port);
|
||||
|
||||
#ifdef VCL_TEST
|
||||
|
||||
@@ -526,7 +526,7 @@ client_rx_thread_fn (void *arg)
|
||||
|
||||
|
||||
static void
|
||||
vl_api_connect_uri_reply_t_handler (vl_api_connect_uri_reply_t * mp)
|
||||
vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
|
||||
{
|
||||
uri_tcp_test_main_t *utm = &uri_tcp_test_main;
|
||||
session_t *session;
|
||||
@@ -1122,7 +1122,7 @@ vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
|
||||
_(BIND_URI_REPLY, bind_uri_reply) \
|
||||
_(UNBIND_URI_REPLY, unbind_uri_reply) \
|
||||
_(ACCEPT_SESSION, accept_session) \
|
||||
_(CONNECT_URI_REPLY, connect_uri_reply) \
|
||||
_(CONNECT_SESSION_REPLY, connect_session_reply) \
|
||||
_(DISCONNECT_SESSION, disconnect_session) \
|
||||
_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
|
||||
_(RESET_SESSION, reset_session) \
|
||||
|
||||
@@ -518,7 +518,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
|
||||
svm_fifo_segment_create_args_t _a, *a = &_a;
|
||||
svm_fifo_segment_private_t *seg;
|
||||
unix_shared_memory_queue_t *client_q;
|
||||
vl_api_connect_uri_reply_t *rmp;
|
||||
vl_api_connect_session_reply_t *rmp;
|
||||
session_t *session = 0;
|
||||
int rv = 0;
|
||||
|
||||
@@ -566,7 +566,7 @@ send_reply:
|
||||
rmp = vl_msg_api_alloc (sizeof (*rmp));
|
||||
memset (rmp, 0, sizeof (*rmp));
|
||||
|
||||
rmp->_vl_msg_id = ntohs (VL_API_CONNECT_URI_REPLY);
|
||||
rmp->_vl_msg_id = ntohs (VL_API_CONNECT_SESSION_REPLY);
|
||||
rmp->context = mp->context;
|
||||
rmp->retval = ntohl (rv);
|
||||
rmp->segment_name_length = vec_len (a->segment_name);
|
||||
@@ -674,7 +674,7 @@ vl_api_disconnect_session_t_handler (vl_api_disconnect_session_t * mp)
|
||||
}
|
||||
|
||||
static void
|
||||
vl_api_connect_uri_reply_t_handler (vl_api_connect_uri_reply_t * mp)
|
||||
vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp)
|
||||
{
|
||||
uri_udp_test_main_t *utm = &uri_udp_test_main;
|
||||
|
||||
@@ -727,7 +727,7 @@ vl_api_connect_uri_reply_t_handler (vl_api_connect_uri_reply_t * mp)
|
||||
#define foreach_uri_msg \
|
||||
_(BIND_URI_REPLY, bind_uri_reply) \
|
||||
_(CONNECT_URI, connect_uri) \
|
||||
_(CONNECT_URI_REPLY, connect_uri_reply) \
|
||||
_(CONNECT_SESSION_REPLY, connect_session_reply) \
|
||||
_(UNBIND_URI_REPLY, unbind_uri_reply) \
|
||||
_(ACCEPT_SESSION, accept_session) \
|
||||
_(DISCONNECT_SESSION, disconnect_session) \
|
||||
|
||||
+105
-120
File diff suppressed because it is too large
Load Diff
@@ -105,7 +105,7 @@ autoreply define unbind_uri {
|
||||
@param client_queue_address - binary API client queue address. Used by
|
||||
local server when connect was redirected.
|
||||
*/
|
||||
define connect_uri {
|
||||
autoreply define connect_uri {
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u8 uri[128];
|
||||
@@ -113,31 +113,6 @@ define connect_uri {
|
||||
u64 options[16];
|
||||
};
|
||||
|
||||
/** \brief vpp->client, connect reply
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param retval - return code for the request
|
||||
@param handle - session handle
|
||||
@param server_rx_fifo - rx (vpp -> vpp-client) fifo address
|
||||
@param server_tx_fifo - tx (vpp-client -> vpp) fifo address
|
||||
@param vpp_event_queue_address - vpp's event queue address
|
||||
@param segment_size - size of segment to be attached. Only for redirects.
|
||||
@param segment_name_length - non-zero if the client needs to attach to
|
||||
the fifo segment. This should only happen
|
||||
if session was redirected.
|
||||
@param segment_name - set if the client needs to attach to the segment
|
||||
*/
|
||||
define connect_uri_reply {
|
||||
u32 context;
|
||||
i32 retval;
|
||||
u64 handle;
|
||||
u64 server_rx_fifo;
|
||||
u64 server_tx_fifo;
|
||||
u64 vpp_event_queue_address;
|
||||
u32 segment_size;
|
||||
u8 segment_name_length;
|
||||
u8 segment_name[128];
|
||||
};
|
||||
|
||||
/** \brief vpp->client, accept this session
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param listener_handle - tells client which listener this pertains to
|
||||
@@ -273,10 +248,9 @@ autoreply define unbind_sock {
|
||||
used to perform redirects
|
||||
@param options - socket options, fifo sizes, etc. when doing redirects
|
||||
*/
|
||||
define connect_sock {
|
||||
autoreply define connect_sock {
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
u32 app_connect;
|
||||
u32 vrf;
|
||||
u8 is_ip4;
|
||||
u8 ip[16];
|
||||
@@ -305,11 +279,19 @@ define bind_sock_reply {
|
||||
u8 segment_name[128];
|
||||
};
|
||||
|
||||
/** \brief vpp/server->client, connect reply
|
||||
/* Dummy connect message -- needed to satisfy api generators
|
||||
*
|
||||
* NEVER USED, doxygen tags elided on purpose.
|
||||
*/
|
||||
define connect_session {
|
||||
u32 client_index;
|
||||
u32 context;
|
||||
};
|
||||
|
||||
/** \brief vpp/server->client, connect reply -- used for all connect_* messages
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param retval - return code for the request
|
||||
@param handle - connection handle
|
||||
@param app_connect - application connection id from connect msg
|
||||
@param server_rx_fifo - rx (vpp -> vpp-client) fifo address
|
||||
@param server_tx_fifo - tx (vpp-client -> vpp) fifo address
|
||||
@param vpp_event_queue_address - vpp's event queue address
|
||||
@@ -318,11 +300,10 @@ define bind_sock_reply {
|
||||
the fifo segment
|
||||
@param segment_name - set if the client needs to attach to the segment
|
||||
*/
|
||||
define connect_sock_reply {
|
||||
define connect_session_reply {
|
||||
u32 context;
|
||||
i32 retval;
|
||||
u64 handle;
|
||||
u32 app_connect;
|
||||
u64 server_rx_fifo;
|
||||
u64 server_tx_fifo;
|
||||
u64 vpp_event_queue_address;
|
||||
|
||||
@@ -38,6 +38,28 @@ typedef enum
|
||||
FIFO_EVENT_RPC,
|
||||
} fifo_event_type_t;
|
||||
|
||||
static inline const char *
|
||||
fifo_event_type_str (fifo_event_type_t et)
|
||||
{
|
||||
switch (et)
|
||||
{
|
||||
case FIFO_EVENT_APP_RX:
|
||||
return "FIFO_EVENT_APP_RX";
|
||||
case FIFO_EVENT_APP_TX:
|
||||
return "FIFO_EVENT_APP_TX";
|
||||
case FIFO_EVENT_TIMEOUT:
|
||||
return "FIFO_EVENT_TIMEOUT";
|
||||
case FIFO_EVENT_DISCONNECT:
|
||||
return "FIFO_EVENT_DISCONNECT";
|
||||
case FIFO_EVENT_BUILTIN_RX:
|
||||
return "FIFO_EVENT_BUILTIN_RX";
|
||||
case FIFO_EVENT_RPC:
|
||||
return "FIFO_EVENT_RPC";
|
||||
default:
|
||||
return "UNKNOWN FIFO EVENT";
|
||||
}
|
||||
}
|
||||
|
||||
#define foreach_session_input_error \
|
||||
_(NO_SESSION, "No session drops") \
|
||||
_(NO_LISTENER, "No listener for dst port drops") \
|
||||
|
||||
@@ -155,7 +155,7 @@ int
|
||||
send_session_connected_callback (u32 app_index, u32 api_context,
|
||||
stream_session_t * s, u8 is_fail)
|
||||
{
|
||||
vl_api_connect_uri_reply_t *mp;
|
||||
vl_api_connect_session_reply_t *mp;
|
||||
unix_shared_memory_queue_t *q;
|
||||
application_t *app;
|
||||
unix_shared_memory_queue_t *vpp_queue;
|
||||
@@ -167,7 +167,7 @@ send_session_connected_callback (u32 app_index, u32 api_context,
|
||||
return -1;
|
||||
|
||||
mp = vl_msg_api_alloc (sizeof (*mp));
|
||||
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_URI_REPLY);
|
||||
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_SESSION_REPLY);
|
||||
mp->context = api_context;
|
||||
if (!is_fail)
|
||||
{
|
||||
@@ -415,7 +415,7 @@ done:
|
||||
static void
|
||||
vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
|
||||
{
|
||||
vl_api_connect_uri_reply_t *rmp;
|
||||
vl_api_connect_session_reply_t *rmp;
|
||||
vnet_connect_args_t _a, *a = &_a;
|
||||
application_t *app;
|
||||
int rv;
|
||||
@@ -447,7 +447,7 @@ vl_api_connect_uri_t_handler (vl_api_connect_uri_t * mp)
|
||||
|
||||
done:
|
||||
/* *INDENT-OFF* */
|
||||
REPLY_MACRO (VL_API_CONNECT_URI_REPLY);
|
||||
REPLY_MACRO (VL_API_CONNECT_SESSION_REPLY);
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
@@ -593,11 +593,11 @@ vl_api_bind_sock_t_handler (vl_api_bind_sock_t * mp)
|
||||
app = application_lookup (mp->client_index);
|
||||
if (app)
|
||||
{
|
||||
ip46_address_t *ip46 = (ip46_address_t *) mp->ip;
|
||||
|
||||
memset (a, 0, sizeof (*a));
|
||||
clib_memcpy (&a->tep.ip, mp->ip, (mp->is_ip4 ?
|
||||
sizeof (ip4_address_t) :
|
||||
sizeof (ip6_address_t)));
|
||||
a->tep.is_ip4 = mp->is_ip4;
|
||||
a->tep.ip = *ip46;
|
||||
a->tep.port = mp->port;
|
||||
a->tep.vrf = mp->vrf;
|
||||
a->app_index = app->index;
|
||||
@@ -637,7 +637,7 @@ done:
|
||||
static void
|
||||
vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
|
||||
{
|
||||
vl_api_connect_sock_reply_t *rmp;
|
||||
vl_api_connect_session_reply_t *rmp;
|
||||
vnet_connect_args_t _a, *a = &_a;
|
||||
application_t *app;
|
||||
int rv;
|
||||
@@ -652,16 +652,14 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
|
||||
if (app)
|
||||
{
|
||||
unix_shared_memory_queue_t *client_q;
|
||||
u8 *ip = mp->is_ip4 ? (u8 *) & a->tep.ip.ip4 : (u8 *) & a->tep.ip;
|
||||
ip46_address_t *ip46 = (ip46_address_t *) mp->ip;
|
||||
|
||||
client_q = vl_api_client_index_to_input_queue (mp->client_index);
|
||||
mp->client_queue_address = pointer_to_uword (client_q);
|
||||
a->tep.is_ip4 = mp->is_ip4;
|
||||
a->tep.ip = *ip46;
|
||||
a->tep.port = mp->port;
|
||||
|
||||
clib_memcpy (ip, mp->ip,
|
||||
(mp->is_ip4 ? sizeof (ip4_address_t) :
|
||||
sizeof (ip6_address_t)));
|
||||
a->tep.vrf = mp->vrf;
|
||||
a->api_context = mp->context;
|
||||
a->app_index = app->index;
|
||||
a->proto = mp->proto;
|
||||
@@ -679,7 +677,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
|
||||
/* Got some error, relay it */
|
||||
|
||||
done:
|
||||
REPLY_MACRO (VL_API_CONNECT_SOCK_REPLY);
|
||||
REPLY_MACRO (VL_API_CONNECT_SESSION_REPLY);
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
|
||||
Reference in New Issue
Block a user