aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-10-17 16:19:41 -0400
committerFlorin Coras <florin.coras@gmail.com>2017-10-17 21:49:17 +0000
commit965fec9089de96c2afbffc3dec3360d043e3eead (patch)
treeee2b32744c95bad97a114d7c282573305feaa047 /src/vnet/session
parentb9f2cf0bff89ccf5c88072213a25efb65fb5516e (diff)
session: fix connect corner case crash.
Change-Id: I54ced42749432335183ee3085a9ccc5f95a87ae9 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vnet/session')
-rwxr-xr-xsrc/vnet/session/session_api.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index e9ddbce7f94..812d727f74b 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -168,29 +168,32 @@ send_session_connected_callback (u32 app_index, u32 api_context,
if (!q)
return -1;
- tc = session_get_transport (s);
- if (!tc)
- is_fail = 1;
mp = vl_msg_api_alloc (sizeof (*mp));
mp->_vl_msg_id = clib_host_to_net_u16 (VL_API_CONNECT_SESSION_REPLY);
mp->context = api_context;
- if (!is_fail)
- {
- vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
- mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
- mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
- mp->handle = session_handle (s);
- mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
- clib_memcpy (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
- mp->is_ip4 = tc->is_ip4;
- mp->lcl_port = tc->lcl_port;
- mp->retval = 0;
- }
- else
+
+ if (is_fail)
+ goto done;
+
+ tc = session_get_transport (s);
+ if (!tc)
{
- mp->retval = clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT);
+ is_fail = 1;
+ goto done;
}
+ vpp_queue = session_manager_get_vpp_event_queue (s->thread_index);
+ mp->server_rx_fifo = pointer_to_uword (s->server_rx_fifo);
+ mp->server_tx_fifo = pointer_to_uword (s->server_tx_fifo);
+ mp->handle = session_handle (s);
+ mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
+ clib_memcpy (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
+ mp->is_ip4 = tc->is_ip4;
+ mp->lcl_port = tc->lcl_port;
+
+done:
+ mp->retval = is_fail ?
+ clib_host_to_net_u32 (VNET_API_ERROR_SESSION_CONNECT) : 0;
vl_msg_api_send_shmem (q, (u8 *) & mp);
return 0;
}