summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/hs_apps/echo_client.c14
-rw-r--r--src/plugins/hs_apps/echo_server.c2
-rw-r--r--src/plugins/hs_apps/http_server.c2
-rw-r--r--src/plugins/hs_apps/proxy.c6
-rw-r--r--src/plugins/http_static/static_server.c3
-rw-r--r--src/plugins/quic/quic.c20
-rw-r--r--src/plugins/tlsmbedtls/tls_mbedtls.c4
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c6
-rw-r--r--src/plugins/unittest/segment_manager_test.c2
-rw-r--r--src/plugins/unittest/session_test.c17
10 files changed, 39 insertions, 37 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index 551e46b987e..3c55c6dc720 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -362,7 +362,8 @@ echo_clients_init (vlib_main_t * vm)
static int
quic_echo_clients_qsession_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s,
+ session_error_t err)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_connect_args_t *a = 0;
@@ -406,7 +407,8 @@ quic_echo_clients_qsession_connected_callback (u32 app_index, u32 api_context,
static int
quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s,
+ session_error_t err)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *session;
@@ -416,7 +418,7 @@ quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
if (PREDICT_FALSE (ecm->run_test != ECHO_CLIENTS_STARTING))
return -1;
- if (is_fail)
+ if (err)
{
clib_warning ("connection %d failed!", api_context);
ecm->run_test = ECHO_CLIENTS_EXITING;
@@ -427,7 +429,7 @@ quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
if (s->listener_handle == SESSION_INVALID_HANDLE)
return quic_echo_clients_qsession_connected_callback (app_index,
api_context, s,
- is_fail);
+ err);
DBG ("STREAM Connection callback %d", api_context);
thread_index = s->thread_index;
@@ -479,7 +481,7 @@ quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
static int
echo_clients_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
echo_client_main_t *ecm = &echo_client_main;
eclient_session_t *session;
@@ -489,7 +491,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
if (PREDICT_FALSE (ecm->run_test != ECHO_CLIENTS_STARTING))
return -1;
- if (is_fail)
+ if (err)
{
clib_warning ("connection %d failed!", api_context);
ecm->run_test = ECHO_CLIENTS_EXITING;
diff --git a/src/plugins/hs_apps/echo_server.c b/src/plugins/hs_apps/echo_server.c
index 362d278119c..c8335e3d813 100644
--- a/src/plugins/hs_apps/echo_server.c
+++ b/src/plugins/hs_apps/echo_server.c
@@ -125,7 +125,7 @@ echo_server_session_reset_callback (session_t * s)
int
echo_server_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
clib_warning ("called...");
return -1;
diff --git a/src/plugins/hs_apps/http_server.c b/src/plugins/hs_apps/http_server.c
index cc998a6f661..ab3bab15b10 100644
--- a/src/plugins/hs_apps/http_server.c
+++ b/src/plugins/hs_apps/http_server.c
@@ -690,7 +690,7 @@ http_server_session_reset_callback (session_t * s)
static int
http_server_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
clib_warning ("called...");
return -1;
diff --git a/src/plugins/hs_apps/proxy.c b/src/plugins/hs_apps/proxy.c
index ca46aef2ae0..83b26222adb 100644
--- a/src/plugins/hs_apps/proxy.c
+++ b/src/plugins/hs_apps/proxy.c
@@ -211,7 +211,7 @@ proxy_reset_callback (session_t * s)
static int
proxy_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
clib_warning ("called...");
return -1;
@@ -363,13 +363,13 @@ static session_cb_vft_t proxy_session_cb_vft = {
static int
active_open_connected_callback (u32 app_index, u32 opaque,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
proxy_main_t *pm = &proxy_main;
proxy_session_t *ps;
u8 thread_index = vlib_get_thread_index ();
- if (is_fail)
+ if (err)
{
clib_warning ("connection %d failed!", opaque);
return 0;
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 888cf416e80..8945ee35036 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -1118,7 +1118,8 @@ http_static_server_session_reset_callback (session_t * s)
static int
http_static_server_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s,
+ session_error_t err)
{
clib_warning ("called...");
return -1;
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 14002a253d7..4d809446130 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1258,18 +1258,19 @@ quic_connect_stream (session_t * quic_session, session_endpoint_cfg_t * sep)
stream_session->session_state = SESSION_STATE_READY;
/* For now we only reset streams. Cleanup will be triggered by timers */
- if (app_worker_init_connected (app_wrk, stream_session))
+ if ((rv = app_worker_init_connected (app_wrk, stream_session)))
{
QUIC_ERR ("failed to app_worker_init_connected");
quicly_reset_stream (stream, QUIC_APP_CONNECT_NOTIFY_ERROR);
- return app_worker_connect_notify (app_wrk, NULL, sep->opaque);
+ return app_worker_connect_notify (app_wrk, NULL, rv, sep->opaque);
}
svm_fifo_add_want_deq_ntf (stream_session->rx_fifo,
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL |
SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY);
- if (app_worker_connect_notify (app_wrk, stream_session, sep->opaque))
+ if (app_worker_connect_notify (app_wrk, stream_session, SESSION_E_NONE,
+ sep->opaque))
{
QUIC_ERR ("failed to notify app");
quic_increment_counter (QUIC_ERROR_CLOSED_STREAM, 1);
@@ -1612,17 +1613,17 @@ quic_on_quic_session_connected (quic_ctx_t * ctx)
/* If quic session connected fails, immediatly close connection */
app_wrk = app_worker_get (ctx->parent_app_wrk_id);
- if (app_worker_init_connected (app_wrk, quic_session))
+ if ((rv = app_worker_init_connected (app_wrk, quic_session)))
{
QUIC_ERR ("failed to app_worker_init_connected");
quic_proto_on_close (ctx_id, thread_index);
- app_worker_connect_notify (app_wrk, NULL, ctx->client_opaque);
+ app_worker_connect_notify (app_wrk, NULL, rv, ctx->client_opaque);
return;
}
quic_session->session_state = SESSION_STATE_CONNECTING;
if ((rv = app_worker_connect_notify (app_wrk, quic_session,
- ctx->client_opaque)))
+ SESSION_E_NONE, ctx->client_opaque)))
{
QUIC_ERR ("failed to notify app %d", rv);
quic_proto_on_close (ctx_id, thread_index);
@@ -1739,7 +1740,8 @@ quic_transfer_connection (u32 ctx_index, u32 dest_thread)
static int
quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index,
- session_t * udp_session, u8 is_fail)
+ session_t * udp_session,
+ session_error_t err)
{
QUIC_DBG (2, "QSession is now connected (id %u)",
udp_session->session_index);
@@ -1759,14 +1761,14 @@ quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index,
ctx = quic_ctx_get (ctx_index, thread_index);
- if (is_fail)
+ if (err)
{
u32 api_context;
app_wrk = app_worker_get_if_valid (ctx->parent_app_wrk_id);
if (app_wrk)
{
api_context = ctx->c_s_index;
- app_worker_connect_notify (app_wrk, 0, api_context);
+ app_worker_connect_notify (app_wrk, 0, SESSION_E_NONE, api_context);
}
return 0;
}
diff --git a/src/plugins/tlsmbedtls/tls_mbedtls.c b/src/plugins/tlsmbedtls/tls_mbedtls.c
index dafb0900805..7b722faf822 100644
--- a/src/plugins/tlsmbedtls/tls_mbedtls.c
+++ b/src/plugins/tlsmbedtls/tls_mbedtls.c
@@ -414,11 +414,11 @@ mbedtls_ctx_handshake_rx (tls_ctx_t * ctx)
*/
if (ctx->srv_hostname)
{
- tls_notify_app_connected (ctx, /* is failed */ 0);
+ tls_notify_app_connected (ctx, SESSION_E_TLS_HANDSHAKE);
return -1;
}
}
- tls_notify_app_connected (ctx, /* is failed */ 0);
+ tls_notify_app_connected (ctx, SESSION_E_NONE);
}
else
{
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 6d0364c3acb..43bb13ff967 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -317,7 +317,7 @@ openssl_handle_handshake_failure (tls_ctx_t * ctx)
/*
* Also handles cleanup of the pre-allocated session
*/
- tls_notify_app_connected (ctx, /* is failed */ 1);
+ tls_notify_app_connected (ctx, SESSION_E_TLS_HANDSHAKE);
}
}
@@ -385,11 +385,11 @@ openssl_ctx_handshake_rx (tls_ctx_t * ctx, session_t * tls_session)
*/
if (ctx->srv_hostname)
{
- tls_notify_app_connected (ctx, /* is failed */ 0);
+ tls_notify_app_connected (ctx, SESSION_E_TLS_HANDSHAKE);
return -1;
}
}
- tls_notify_app_connected (ctx, /* is failed */ 0);
+ tls_notify_app_connected (ctx, SESSION_E_NONE);
}
else
{
diff --git a/src/plugins/unittest/segment_manager_test.c b/src/plugins/unittest/segment_manager_test.c
index 8f362f40cb6..4992e2e1670 100644
--- a/src/plugins/unittest/segment_manager_test.c
+++ b/src/plugins/unittest/segment_manager_test.c
@@ -39,7 +39,7 @@ dummy_session_reset_callback (session_t * s)
static int
dummy_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
clib_warning ("called...");
return 0;
diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c
index 8d5566feb46..9368f9f80f7 100644
--- a/src/plugins/unittest/session_test.c
+++ b/src/plugins/unittest/session_test.c
@@ -54,7 +54,7 @@ volatile u32 connected_session_index = ~0;
volatile u32 connected_session_thread = ~0;
int
dummy_session_connected_callback (u32 app_index, u32 api_context,
- session_t * s, u8 is_fail)
+ session_t * s, session_error_t err)
{
if (s)
{
@@ -596,7 +596,7 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
connect_args.app_index = client_index;
error = vnet_connect (&connect_args);
SESSION_TEST ((error != 0), "client connect should return error code");
- SESSION_TEST ((error == VNET_API_ERROR_INVALID_VALUE),
+ SESSION_TEST ((error == SESSION_E_INVALID_RMT_IP),
"error code should be invalid value (zero ip)");
SESSION_TEST ((dummy_segment_count == 0),
"shouldn't have received request to map new segment");
@@ -678,8 +678,8 @@ session_test_namespace (vlib_main_t * vm, unformat_input_t * input)
vnet_application_attach (&attach_args);
error = vnet_connect (&connect_args);
SESSION_TEST ((error != 0), "client connect should return error code");
- SESSION_TEST ((error == VNET_API_ERROR_SESSION_CONNECT),
- "error code should be connect (not in same ns)");
+ SESSION_TEST ((error == SESSION_E_NOROUTE),
+ "error code should be noroute (not in same ns)");
detach_args.app_index = client_index;
vnet_application_detach (&detach_args);
@@ -1255,8 +1255,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
/* Try connecting */
error = vnet_connect (&connect_args);
SESSION_TEST ((error != 0), "connect should fail");
- SESSION_TEST ((error == VNET_API_ERROR_APP_CONNECT_FILTERED),
- "connect should be filtered");
+ SESSION_TEST ((error == SESSION_E_FILTERED), "connect should be filtered");
sep.ip.ip4.as_u32 -= 1 << 24;
@@ -1529,8 +1528,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
error = vnet_connect (&connect_args);
SESSION_TEST ((error != 0), "connect should fail");
- SESSION_TEST ((error == VNET_API_ERROR_APP_CONNECT_FILTERED),
- "connect should be filtered");
+ SESSION_TEST ((error == SESSION_E_FILTERED), "connect should be filtered");
/*
* Lookup test namespace
@@ -1542,8 +1540,7 @@ session_test_rules (vlib_main_t * vm, unformat_input_t * input)
connect_args.app_index = server_index;
error = vnet_connect (&connect_args);
SESSION_TEST ((error != 0), "connect should fail");
- SESSION_TEST ((error == VNET_API_ERROR_APP_CONNECT_FILTERED),
- "connect should be filtered");
+ SESSION_TEST ((error == SESSION_E_FILTERED), "connect should be filtered");
args.table_args.is_add = 0;
vnet_session_rule_add_del (&args);