diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-05-16 16:35:40 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-05-16 19:08:51 +0000 |
commit | ba65ca496af5766932a762bb99a758dbfcb580ec (patch) | |
tree | 40d10f3c77e23897d256c95202bc4bcbdf35be60 /src | |
parent | 8a6e1b190c63cc596aed33f84b5989b64d276423 (diff) |
Add transport_opts to connect_sock bapi
Needed by QUIC to distinguish Q/Ssessions
Change-Id: Idcc9e46f86f54a7d06ce6d870edec1766e95c82d
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/vcl/vcl_bapi.c | 1 | ||||
-rw-r--r-- | src/vcl/vcl_private.h | 1 | ||||
-rw-r--r-- | src/vnet/session/application.c | 7 | ||||
-rw-r--r-- | src/vnet/session/application_worker.c | 2 | ||||
-rw-r--r-- | src/vnet/session/session.api | 2 | ||||
-rwxr-xr-x | src/vnet/session/session_api.c | 3 | ||||
-rw-r--r-- | src/vnet/session/transport.c | 18 |
7 files changed, 28 insertions, 6 deletions
diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c index b28398101b3..3ccac4740fc 100644 --- a/src/vcl/vcl_bapi.c +++ b/src/vcl/vcl_bapi.c @@ -509,6 +509,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; 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 8bafa5f74b4..14f461d9b56 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -170,6 +170,7 @@ typedef struct u8 is_vep_session; u8 has_rx_evt; u32 attr; + u64 transport_opts; vppcom_epoll_t vep; int libc_epfd; svm_msg_q_t *our_evt_q; diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c index 4bae8dba4de..30957870860 100644 --- a/src/vnet/session/application.c +++ b/src/vnet/session/application.c @@ -582,7 +582,7 @@ application_alloc_and_init (app_init_args_t * a) a->app_index = app->app_index; APP_DBG ("New app name: %v api index: %u index %u", app->name, - app->api_client_index, app->app_index); + a->api_client_index, app->app_index); return 0; } @@ -597,8 +597,7 @@ application_free (application_t * app) * The app event queue allocated in first segment is cleared with * the segment manager. No need to explicitly free it. */ - APP_DBG ("Delete app name %v api index: %d index: %d", app->name, - app->api_client_index, app->app_index); + APP_DBG ("Delete app name %v index: %d", app->name, app->app_index); if (application_is_proxy (app)) application_remove_proxy (app); @@ -641,7 +640,7 @@ application_detach_process (application_t * app, u32 api_client_index) } APP_DBG ("Detaching for app %v index %u api client index %u", app->name, - app->app_index, app->api_client_index); + app->app_index, api_client_index); /* *INDENT-OFF* */ pool_foreach (wrk_map, app->worker_maps, ({ diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c index 081dbbecdac..a30191c7cd0 100644 --- a/src/vnet/session/application_worker.c +++ b/src/vnet/session/application_worker.c @@ -33,7 +33,7 @@ app_worker_alloc (application_t * app) app_wrk->wrk_map_index = ~0; app_wrk->connects_seg_manager = APP_INVALID_SEGMENT_MANAGER_INDEX; app_wrk->first_segment_manager = APP_INVALID_SEGMENT_MANAGER_INDEX; - APP_DBG ("New app %v worker %u", app_get_name (app), app_wrk->wrk_index); + APP_DBG ("New app %v worker %u", app->name, app_wrk->wrk_index); return app_wrk; } diff --git a/src/vnet/session/session.api b/src/vnet/session/session.api index c22c18fe3cf..53d05dfe426 100644 --- a/src/vnet/session/session.api +++ b/src/vnet/session/session.api @@ -250,6 +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). */ autoreply define connect_sock { u32 client_index; @@ -264,6 +265,7 @@ autoreply define connect_sock { u8 proto; u8 hostname_len; u8 hostname[hostname_len]; + u64 transport_opts; }; /** \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 85a4c6197ec..ed716678f2a 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -891,6 +891,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; if (mp->hostname_len) { vec_validate (a->sep_ext.hostname, mp->hostname_len - 1); @@ -901,7 +902,7 @@ vl_api_connect_sock_t_handler (vl_api_connect_sock_t * mp) a->app_index = app->app_index; a->wrk_map_index = mp->wrk_index; if ((rv = vnet_connect (a))) - clib_warning ("connect returned: %u", rv); + clib_warning ("connect returned: %U", format_vnet_api_errno, rv); vec_free (a->sep_ext.hostname); } else diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index 0679eaa1079..6077ab19070 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -66,12 +66,21 @@ format_transport_proto (u8 * s, va_list * args) case TRANSPORT_PROTO_SCTP: s = format (s, "SCTP"); break; + case TRANSPORT_PROTO_NONE: + s = format (s, "NONE"); + break; + case TRANSPORT_PROTO_TLS: + s = format (s, "TLS"); + break; case TRANSPORT_PROTO_UDPC: s = format (s, "UDPC"); break; case TRANSPORT_PROTO_QUIC: s = format (s, "QUIC"); break; + default: + s = format (s, "UNKNOWN"); + break; } return s; } @@ -91,12 +100,21 @@ format_transport_proto_short (u8 * s, va_list * args) case TRANSPORT_PROTO_SCTP: s = format (s, "S"); break; + case TRANSPORT_PROTO_NONE: + s = format (s, "N"); + break; + case TRANSPORT_PROTO_TLS: + s = format (s, "J"); + break; case TRANSPORT_PROTO_UDPC: s = format (s, "U"); break; case TRANSPORT_PROTO_QUIC: s = format (s, "Q"); break; + default: + s = format (s, "?"); + break; } return s; } |