aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-12-18 13:37:45 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-07 21:45:43 +0000
commit48ec77e84ec4ed0ff38c0c772084381be4d960af (patch)
tree4f8e5bfdf218f852ce69f57d8a01994ce90760ed /src/plugins
parentbb49148160b7a61fe871bf7c075cbbb01a937254 (diff)
quic: Hotfix crypto context on migrate
Type: fix quicly_connections have internal references to crypto contexts which need to be updated when we switch thread as the supporting pools are thread-based. This under the assumption that the new contexts will be exactly identical Change-Id: I38083e59657ff068e347d9e7b47abe91a1167b6c Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> (cherry picked from commit d9942bcc61d83cee390fc2c6a428e562ec9750f0)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/quic/quic.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 56e99452a9a..98090666e83 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1464,6 +1464,19 @@ quic_on_client_connected (quic_ctx_t * ctx)
return 0;
}
+static inline void
+quic_update_conn_ctx (quicly_conn_t * conn, quicly_context_t * quicly_context)
+{
+ /* we need to update the quicly_conn on migrate
+ * as it contains a pointer to the crypto context */
+ ptls_context_t **tls;
+ quicly_context_t **_quicly_context;
+ _quicly_context = (quicly_context_t **) conn;
+ *_quicly_context = quicly_context;
+ tls = (ptls_context_t **) quicly_get_tls (conn);
+ *tls = quicly_context->tls;
+}
+
static void
quic_receive_connection (void *arg)
{
@@ -1471,6 +1484,7 @@ quic_receive_connection (void *arg)
quic_ctx_t *temp_ctx, *new_ctx;
clib_bihash_kv_16_8_t kv;
quicly_conn_t *conn;
+ quicly_context_t *quicly_context;
session_t *udp_session;
temp_ctx = arg;
@@ -1488,6 +1502,9 @@ quic_receive_connection (void *arg)
new_ctx->c_c_index = new_ctx_id;
conn = new_ctx->conn;
+ quicly_context = quic_get_quicly_ctx_from_ctx (new_ctx);
+ quic_update_conn_ctx (conn, quicly_context);
+
quic_store_conn_ctx (conn, new_ctx);
quic_make_connection_key (&kv, quicly_get_master_id (conn));
kv.value = ((u64) thread_index) << 32 | (u64) new_ctx_id;