diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/uri/uri_tcp_test.c | 6 | ||||
-rw-r--r-- | src/vnet/session/session.api | 6 | ||||
-rw-r--r-- | src/vnet/session/session.c | 2 | ||||
-rwxr-xr-x | src/vnet/session/session_api.c | 7 |
4 files changed, 20 insertions, 1 deletions
diff --git a/src/uri/uri_tcp_test.c b/src/uri/uri_tcp_test.c index 89f070f72cd..d3c4a75ddf3 100755 --- a/src/uri/uri_tcp_test.c +++ b/src/uri/uri_tcp_test.c @@ -542,6 +542,12 @@ vl_api_connect_session_reply_t_handler (vl_api_connect_session_reply_t * mp) utm->state = STATE_FAILED; return; } + else + { + clib_warning ("connected with local ip %U port %d", format_ip46_address, + mp->lcl_ip, mp->is_ip4, + clib_net_to_host_u16 (mp->lcl_port)); + } utm->vpp_event_queue = uword_to_pointer (mp->vpp_event_queue_address, diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api index 12a5d10429c..fee98c2c8ff 100644 --- a/src/vnet/session/session.api +++ b/src/vnet/session/session.api @@ -303,6 +303,9 @@ define connect_session { @param segment_name_length - non-zero if the client needs to attach to the fifo segment @param segment_name - set if the client needs to attach to the segment + @param lcl_ip - local ip for connection + @param is_ip4 - flag to indicate if ip is v4 or v6 + @param lcl_port - local port */ define connect_session_reply { u32 context; @@ -314,6 +317,9 @@ define connect_session_reply { u32 segment_size; u8 segment_name_length; u8 segment_name[128]; + u8 lcl_ip[16]; + u8 is_ip4; + u16 lcl_port; }; /** \brief enable/disable session layer diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 5893b6558f0..34707e007e9 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -1008,7 +1008,7 @@ session_type_from_proto_and_ip (transport_proto_t proto, u8 is_ip4) transport_connection_t * session_get_transport (stream_session_t * s) { - if (s->session_state >= SESSION_STATE_READY) + if (s->session_state != SESSION_STATE_LISTENING) return tp_vfts[s->session_type].get_connection (s->connection_index, s->thread_index); return 0; diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 432c7ba6013..e9ddbce7f94 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -160,6 +160,7 @@ send_session_connected_callback (u32 app_index, u32 api_context, unix_shared_memory_queue_t *q; application_t *app; unix_shared_memory_queue_t *vpp_queue; + transport_connection_t *tc; app = application_get (app_index); q = vl_api_client_index_to_input_queue (app->api_client_index); @@ -167,6 +168,9 @@ 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; @@ -177,6 +181,9 @@ send_session_connected_callback (u32 app_index, u32 api_context, 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 |