summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/external/packages/quicly.mk8
-rw-r--r--build/external/patches/quicly_0.0.5-vpp/0001-Add-function-ptr-in-ptls-ctx-for-aead_encrypt.patch33
-rw-r--r--build/external/patches/quicly_0.0.5-vpp/0001-cmake-install.patch60
-rw-r--r--src/plugins/quic/quic.c61
4 files changed, 109 insertions, 53 deletions
diff --git a/build/external/packages/quicly.mk b/build/external/packages/quicly.mk
index e4926a6a277..e14a513d8be 100644
--- a/build/external/packages/quicly.mk
+++ b/build/external/packages/quicly.mk
@@ -11,9 +11,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-quicly_version := 0.0.3-vpp
+quicly_version := 0.0.5-vpp
quicly_tarball := quicly_$(quicly_version).tar.gz
-quicly_tarball_md5sum := fa4be6d9039967b380bbf14c96e34cdc
+quicly_tarball_md5sum := 47f6d6324412efcbd058cce1b1ebc045
quicly_tarball_strip_dirs := 1
quicly_url := https://github.com/vpp-quic/quicly/releases/download/v$(quicly_version)/quicly_$(quicly_version).tar.gz
@@ -21,13 +21,13 @@ picotls_build_dir := $(B)/build-picotls
define quicly_build_cmds
@cd $(quicly_build_dir) && \
- $(CMAKE) -DCMAKE_INSTALL_PREFIX:PATH=$(quicly_install_dir) \
+ $(CMAKE) -DWITH_DTRACE=OFF -DCMAKE_INSTALL_PREFIX:PATH=$(quicly_install_dir) \
$(quicly_src_dir) > $(quicly_build_log)
@$(MAKE) $(MAKE_ARGS) -C $(quicly_build_dir) > $(quicly_build_log)
@mkdir -p $(picotls_build_dir)
@cd $(picotls_build_dir) && \
- $(CMAKE) -DCMAKE_INSTALL_PREFIX:PATH=$(quicly_install_dir) \
+ $(CMAKE) -DWITH_DTRACE=OFF -DCMAKE_INSTALL_PREFIX:PATH=$(quicly_install_dir) \
$(quicly_src_dir)/deps/picotls > $(quicly_build_log)
endef
diff --git a/build/external/patches/quicly_0.0.5-vpp/0001-Add-function-ptr-in-ptls-ctx-for-aead_encrypt.patch b/build/external/patches/quicly_0.0.5-vpp/0001-Add-function-ptr-in-ptls-ctx-for-aead_encrypt.patch
new file mode 100644
index 00000000000..80f3bcb684f
--- /dev/null
+++ b/build/external/patches/quicly_0.0.5-vpp/0001-Add-function-ptr-in-ptls-ctx-for-aead_encrypt.patch
@@ -0,0 +1,33 @@
+diff --git a/deps/picotls/include/picotls.h b/deps/picotls/include/picotls.h
+index 06d62f9..de33b86 100644
+--- a/deps/picotls/include/picotls.h
++++ b/deps/picotls/include/picotls.h
+@@ -276,6 +276,8 @@ typedef struct st_ptls_aead_context_t {
+ size_t (*do_encrypt_final)(struct st_ptls_aead_context_t *ctx, void *output);
+ size_t (*do_decrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, const void *iv,
+ const void *aad, size_t aadlen);
++ size_t (*do_encrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq,
++ const void *iv, const void *aad, size_t aadlen);
+ } ptls_aead_context_t;
+
+ /**
+diff --git a/deps/picotls/lib/picotls.c b/deps/picotls/lib/picotls.c
+index 70d2fef..f98f7b4 100644
+--- a/deps/picotls/lib/picotls.c
++++ b/deps/picotls/lib/picotls.c
+@@ -4890,6 +4890,13 @@ size_t ptls_aead_encrypt(ptls_aead_context_t *ctx, void *output, const void *inp
+ {
+ size_t off = 0;
+
++ if(ctx->do_encrypt)
++ {
++ uint8_t iv[PTLS_MAX_IV_SIZE];
++ ptls_aead__build_iv(ctx, iv, seq);
++ return ctx->do_encrypt(ctx, output, input, inlen, seq, iv, aad, aadlen);
++ }
++
+ ptls_aead_encrypt_init(ctx, seq, aad, aadlen);
+ off += ptls_aead_encrypt_update(ctx, ((uint8_t *)output) + off, input, inlen);
+ off += ptls_aead_encrypt_final(ctx, ((uint8_t *)output) + off);
+
+
diff --git a/build/external/patches/quicly_0.0.5-vpp/0001-cmake-install.patch b/build/external/patches/quicly_0.0.5-vpp/0001-cmake-install.patch
new file mode 100644
index 00000000000..0ca7d2986d4
--- /dev/null
+++ b/build/external/patches/quicly_0.0.5-vpp/0001-cmake-install.patch
@@ -0,0 +1,60 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f5478d3..156df4c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -65,6 +65,8 @@ IF (WITH_DTRACE)
+ ENDIF ()
+ ENDIF ()
+
++SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
++
+ ADD_LIBRARY(quicly ${QUICLY_LIBRARY_FILES})
+
+ ADD_CUSTOM_COMMAND(
+@@ -84,6 +86,16 @@ TARGET_LINK_LIBRARIES(examples-echo quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS}
+
+ ADD_EXECUTABLE(udpfw t/udpfw.c)
+
++INSTALL (
++ DIRECTORY ${CMAKE_SOURCE_DIR}/include/
++ DESTINATION include
++ FILES_MATCHING PATTERN "*.h")
++
++INSTALL(TARGETS quicly
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++
+ ADD_CUSTOM_TARGET(check env BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} WITH_DTRACE=${WITH_DTRACE} prove --exec "sh -c" -v ${CMAKE_CURRENT_BINARY_DIR}/*.t t/*.t
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS cli test.t)
+Submodule deps/picotls contains untracked content
+Submodule deps/picotls contains modified content
+diff --git a/deps/picotls/CMakeLists.txt b/deps/picotls/CMakeLists.txt
+index 874b9be..14411e2 100644
+--- a/deps/picotls/CMakeLists.txt
++++ b/deps/picotls/CMakeLists.txt
+@@ -12,6 +12,7 @@ IF (WITH_DTRACE)
+ MESSAGE(STATUS "Enabling USDT support")
+ ENDIF ()
+
++SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
+ SET(CMAKE_C_FLAGS "-std=c99 -Wall -O2 -g ${CC_WARNING_FLAGS} ${CMAKE_C_FLAGS}")
+ INCLUDE_DIRECTORIES(
+ deps/cifra/src/ext
+@@ -131,6 +132,15 @@ ELSE ()
+ MESSAGE(WARNING "Disabling OpenSSL support (requires 1.0.1 or newer)")
+ ENDIF ()
+
++INSTALL (DIRECTORY ${CMAKE_SOURCE_DIR}/include/
++ DESTINATION include
++ FILES_MATCHING PATTERN "*.h")
++
++INSTALL(TARGETS picotls-core picotls-openssl
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
++
+ ADD_CUSTOM_TARGET(check env BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} prove --exec '' -v ${CMAKE_CURRENT_BINARY_DIR}/*.t t/*.t WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${TEST_EXES} cli)
+
+ IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 4aaed1a4ec2..590db5a064a 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -237,42 +237,7 @@ quic_increment_counter (u8 evt, u8 val)
vlib_node_increment_counter (vm, quic_input_node.index, evt, val);
}
-struct st_quic_event_log_t
-{
- quicly_event_logger_t super;
-};
-
-void
-quic_event_log (quicly_event_logger_t * _self, quicly_event_type_t type,
- const quicly_event_attribute_t * attributes,
- size_t num_attributes)
-{
- if (type == QUICLY_EVENT_TYPE_PACKET_LOST)
- {
- QUIC_DBG (1, "QUIC packet loss");
- quic_increment_counter (QUIC_ERROR_PACKET_DROP, 1);
- }
-}
-
-quicly_event_logger_t *
-quic_new_event_logger ()
-{
- struct st_quic_event_log_t *self;
- if ((self = clib_mem_alloc (sizeof (*self))) == NULL)
- return NULL;
- /* *INDENT-OFF* */
- *self = (struct st_quic_event_log_t) {{quic_event_log}};
- /* *INDENT-ON* */
- return &self->super;
-}
-
-void
-quic_free_event_logger (quicly_event_logger_t * _self)
-{
- struct st_quicly_default_event_log_t *self = (void *) _self;
- clib_mem_free (self);
-}
/**
* Called when quicly return an error
@@ -350,15 +315,15 @@ quic_send_datagram (session_t * udp_session, quicly_datagram_t * packet)
/* Read dest address from quicly-provided sockaddr */
if (hdr.is_ip4)
{
- ASSERT (packet->sa.sa_family == AF_INET);
- struct sockaddr_in *sa4 = (struct sockaddr_in *) &packet->sa;
+ ASSERT (packet->dest.sa.sa_family == AF_INET);
+ struct sockaddr_in *sa4 = (struct sockaddr_in *) &packet->dest.sa;
hdr.rmt_port = sa4->sin_port;
hdr.rmt_ip.ip4.as_u32 = sa4->sin_addr.s_addr;
}
else
{
- ASSERT (packet->sa.sa_family == AF_INET6);
- struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) &packet->sa;
+ ASSERT (packet->dest.sa.sa_family == AF_INET6);
+ struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) &packet->dest.sa;
hdr.rmt_port = sa6->sin6_port;
clib_memcpy (&hdr.rmt_ip.ip6, &sa6->sin6_addr, 16);
}
@@ -972,9 +937,6 @@ quic_store_quicly_ctx (application_t * app, u8 is_client)
quicly_ctx->now = &quicly_vpp_now_cb;
quicly_amend_ptls_context (quicly_ctx->tls);
- quicly_ctx->event_log.mask = UINT64_MAX; /* logs */
- quicly_ctx->event_log.cb = quic_new_event_logger ();
-
quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;
quicly_ctx->transport_params.max_streams_bidi = (uint64_t) 1 << 60;
@@ -989,6 +951,7 @@ quic_store_quicly_ctx (application_t * app, u8 is_client)
strlen (quicly_ctx_data->cid_key));
quicly_ctx->cid_encryptor =
quicly_new_default_cid_encryptor (&ptls_openssl_bfecb,
+ &ptls_openssl_aes128ecb,
&ptls_openssl_sha256, key_vec);
if (is_client)
return;
@@ -1584,7 +1547,8 @@ quic_session_connected_callback (u32 quic_app_index, u32 ctx_index,
quicly_ctx = quic_get_quicly_ctx_from_ctx (ctx);
ret = quicly_connect (&ctx->conn, quicly_ctx, (char *) ctx->srv_hostname,
- sa, salen, &quic_main.next_cid,
+ sa, NULL, &quic_main.next_cid, ptls_iovec_init (NULL,
+ 0),
&quic_main.hs_properties, NULL);
++quic_main.next_cid.master_id;
/* Save context handle in quicly connection */
@@ -1801,7 +1765,7 @@ quic_find_packet_ctx (u32 * ctx_thread, u32 * ctx_index,
}
ctx_ = quic_ctx_get (index, vlib_get_thread_index ());
conn_ = ctx_->conn;
- if (conn_ && quicly_is_destination (conn_, sa, salen, packet))
+ if (conn_ && quicly_is_destination (conn_, NULL, sa, packet))
{
QUIC_DBG (3, "Connection found");
*ctx_index = index;
@@ -1867,9 +1831,8 @@ quic_create_connection (u32 ctx_index, struct sockaddr *sa,
* TODO: check if socket is actually listening? */
ctx = quic_ctx_get (ctx_index, thread_index);
quicly_ctx = quic_get_quicly_ctx_from_ctx (ctx);
- if ((rv = quicly_accept (&conn, quicly_ctx, sa, salen,
- &packet, ptls_iovec_init (NULL, 0),
- &quic_main.next_cid, NULL)))
+ if ((rv = quicly_accept (&conn, quicly_ctx, NULL, sa,
+ &packet, NULL, &quic_main.next_cid, NULL)))
{
/* Invalid packet, pass */
assert (conn == NULL);
@@ -1915,7 +1878,7 @@ quic_reset_connection (u64 udp_session_handle,
|| packet.cid.dest.plaintext.thread_id != 0)
return 0;
quicly_ctx = quic_get_quicly_ctx_from_udp (udp_session_handle);
- dgram = quicly_send_stateless_reset (quicly_ctx, sa, salen,
+ dgram = quicly_send_stateless_reset (quicly_ctx, sa, NULL,
&packet.cid.dest.plaintext);
if (dgram == NULL)
return 1;
@@ -2031,7 +1994,7 @@ quic_process_one_rx_packet (u64 udp_session_handle,
if (err == 0)
{
ctx = quic_ctx_get (packet_ctx->ctx_index, thread_index);
- rv = quicly_receive (ctx->conn, &packet_ctx->packet);
+ rv = quicly_receive (ctx->conn, NULL, sa, &packet_ctx->packet);
if (rv)
QUIC_DBG (1, "quicly_receive return error %d", rv);
}