aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/hs_apps/echo_client.c3
-rw-r--r--src/plugins/quic/quic.c24
-rw-r--r--src/vcl/vcl_bapi.c2
-rw-r--r--src/vcl/vcl_private.h2
-rw-r--r--src/vcl/vppcom.c4
-rw-r--r--src/vcl/vppcom.h2
-rw-r--r--src/vnet/session/application_interface.c3
-rw-r--r--src/vnet/session/session.api4
-rwxr-xr-xsrc/vnet/session/session_api.c2
-rw-r--r--src/vnet/session/session_types.h3
10 files changed, 25 insertions, 24 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index bcf4176ca71..1d036b69ecb 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -376,8 +376,7 @@ quic_echo_clients_qsession_connected_callback (u32 app_index, u32 api_context,
vec_validate (a, 1);
a->uri = (char *) ecm->connect_uri;
parse_uri (a->uri, &sep);
- sep.transport_opts = session_handle (s);
- sep.port = 0; /* QUIC: create a stream flag */
+ sep.parent_handle = session_handle (s);
for (stream_n = 0; stream_n < ecm->quic_streams; stream_n++)
{
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 39e460e1ac8..1575f2bff5f 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1334,10 +1334,10 @@ allocate_quicly_ctx (application_t * app, u8 is_client)
*****************************************************************************/
static int
-quic_connect_new_stream (session_endpoint_cfg_t * sep)
+quic_connect_new_stream (session_t * quic_session, u32 opaque)
{
uint64_t quic_session_handle;
- session_t *quic_session, *stream_session;
+ session_t *stream_session;
quic_stream_data_t *stream_data;
quicly_stream_t *stream;
quicly_conn_t *conn;
@@ -1347,12 +1347,11 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
int rv;
/* Find base session to which the user want to attach a stream */
- quic_session_handle = sep->transport_opts;
- QUIC_DBG (2, "Opening new stream (qsession %u)", sep->transport_opts);
- quic_session = session_get_from_handle (quic_session_handle);
+ quic_session_handle = session_handle (quic_session);
+ QUIC_DBG (2, "Opening new stream (qsession %u)", quic_session_handle);
- if (quic_session->session_type !=
- session_type_from_proto_and_ip (TRANSPORT_PROTO_QUIC, sep->is_ip4))
+ if (session_type_transport_proto (quic_session->session_type) !=
+ TRANSPORT_PROTO_QUIC)
{
QUIC_DBG (1, "received incompatible session");
return -1;
@@ -1415,7 +1414,7 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
quicly_reset_stream (stream, QUIC_APP_ALLOCATION_ERROR);
session_free_w_fifos (stream_session);
quic_ctx_free (sctx);
- return app_worker_connect_notify (app_wrk, NULL, sep->opaque);
+ return app_worker_connect_notify (app_wrk, NULL, opaque);
}
svm_fifo_add_want_deq_ntf (stream_session->rx_fifo,
@@ -1423,7 +1422,7 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY);
stream_session->session_state = SESSION_STATE_READY;
- if (app_worker_connect_notify (app_wrk, stream_session, sep->opaque))
+ if (app_worker_connect_notify (app_wrk, stream_session, opaque))
{
QUIC_DBG (1, "failed to notify app");
quicly_reset_stream (stream, QUIC_APP_CONNECT_NOTIFY_ERROR);
@@ -1494,9 +1493,12 @@ quic_connect (transport_endpoint_cfg_t * tep)
{
QUIC_DBG (2, "Called quic_connect");
session_endpoint_cfg_t *sep = (session_endpoint_cfg_t *) tep;
+ session_t *quic_session;
sep = (session_endpoint_cfg_t *) tep;
- if (sep->port == 0) /* TODO add mask on transport_opts */
- return quic_connect_new_stream (sep);
+
+ quic_session = session_get_from_handle_if_valid (sep->parent_handle);
+ if (quic_session)
+ return quic_connect_new_stream (quic_session, sep->opaque);
else
return quic_connect_new_connection (sep);
}
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c
index 7abb45b6330..2bfc7c73f92 100644
--- a/src/vcl/vcl_bapi.c
+++ b/src/vcl/vcl_bapi.c
@@ -517,7 +517,7 @@ vppcom_send_connect_sock (vcl_session_t * session)
cmp->context = session->session_index;
cmp->wrk_index = wrk->vpp_wrk_index;
cmp->is_ip4 = session->transport.is_ip4;
- cmp->transport_opts = session->transport_opts;
+ cmp->parent_handle = session->parent_handle;
clib_memcpy_fast (cmp->ip, &session->transport.rmt_ip, sizeof (cmp->ip));
cmp->port = session->transport.rmt_port;
cmp->proto = session->session_type;
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index d46208cd035..552fdd811ec 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -173,7 +173,7 @@ typedef struct
int n_accepted_sessions;
u8 has_rx_evt;
u32 attr;
- u64 transport_opts;
+ u64 parent_handle;
vppcom_epoll_t vep;
int libc_epfd;
svm_msg_q_t *our_evt_q;
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 3205a812ce4..69d9285ff7e 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -1491,7 +1491,7 @@ vppcom_session_connect (uint32_t session_handle, vppcom_endpt_t * server_ep)
clib_memcpy_fast (&session->transport.rmt_ip.ip6, server_ep->ip,
sizeof (ip6_address_t));
session->transport.rmt_port = server_ep->port;
- session->transport_opts = VCL_INVALID_SESSION_HANDLE;
+ session->parent_handle = VCL_INVALID_SESSION_HANDLE;
VDBG (0, "session handle %u: connecting to server %s %U "
"port %d proto %s", session_handle,
@@ -1556,7 +1556,7 @@ vppcom_session_stream_connect (uint32_t session_handle,
session->transport.is_ip4 = parent_session->transport.is_ip4;
session->transport.rmt_ip.ip4.as_u32 = (uint32_t) 1;
session->transport.rmt_port = 0;
- session->transport_opts = parent_session->vpp_handle;
+ session->parent_handle = parent_session->vpp_handle;
VDBG (0, "session handle %u: connecting to session %u [0x%llx]",
session_handle, parent_session_handle, parent_session->vpp_handle);
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index b05eae7150c..90bec310d06 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -105,7 +105,7 @@ typedef struct vppcom_endpt_t_
uint8_t is_ip4;
uint8_t *ip;
uint16_t port;
- uint64_t transport_opts;
+ uint64_t parent_handle;
} vppcom_endpt_t;
typedef uint32_t vcl_session_handle_t;
diff --git a/src/vnet/session/application_interface.c b/src/vnet/session/application_interface.c
index ab011bda1b9..a6d1a029f13 100644
--- a/src/vnet/session/application_interface.c
+++ b/src/vnet/session/application_interface.c
@@ -79,10 +79,9 @@ unformat_vnet_uri (unformat_input_t * input, va_list * args)
return 1;
}
else if (unformat (input, "%U://session/%lu", unformat_transport_proto,
- &transport_proto, &sep->transport_opts))
+ &transport_proto, &sep->parent_handle))
{
sep->transport_proto = transport_proto;
- sep->is_ip4 = 1;
sep->ip.ip4.as_u32 = 1; /* ip need to be non zero in vnet */
return 1;
}
diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api
index 53d05dfe426..533f65e85a2 100644
--- a/src/vnet/session/session.api
+++ b/src/vnet/session/session.api
@@ -250,7 +250,7 @@ autoreply define unbind_sock {
@param hostname-len - length of hostname
@param hostname - destination's hostname. If present, used by protocols
like tls.
- @param transport_opts - transport option (e.g. session id for quic).
+ @param parent_handle - handle of parent session (e.g. for opening quic streams).
*/
autoreply define connect_sock {
u32 client_index;
@@ -265,7 +265,7 @@ autoreply define connect_sock {
u8 proto;
u8 hostname_len;
u8 hostname[hostname_len];
- u64 transport_opts;
+ u64 parent_handle;
};
/** \brief ask app to add a new cut-through registration
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index e8550d6c2a8..479c5d1ca83 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -889,7 +889,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp)
a->sep.transport_proto = mp->proto;
a->sep.peer.fib_index = mp->vrf;
a->sep.peer.sw_if_index = ENDPOINT_INVALID_INDEX;
- a->sep_ext.transport_opts = mp->transport_opts;
+ a->sep_ext.parent_handle = mp->parent_handle;
if (mp->hostname_len)
{
vec_validate (a->sep_ext.hostname, mp->hostname_len - 1);
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index 1c03aa25672..682094c9cb6 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -43,7 +43,7 @@ typedef struct _session_endpoint_cfg
u32 ns_index;
u8 original_tp;
u8 *hostname;
- u64 transport_opts;
+ u64 parent_handle;
} session_endpoint_cfg_t;
#define SESSION_IP46_ZERO \
@@ -83,6 +83,7 @@ typedef struct _session_endpoint_cfg
.app_wrk_index = ENDPOINT_INVALID_INDEX, \
.opaque = ENDPOINT_INVALID_INDEX, \
.hostname = 0, \
+ .parent_handle = SESSION_INVALID_HANDLE \
}
#define session_endpoint_to_transport(_sep) ((transport_endpoint_t *)_sep)