From: Neil Horman Date: Wed, 29 Jan 2025 19:10:09 +0000 (-0500) Subject: Fix ossl_quic_trace to fetch connection short conn id len X-Git-Tag: openssl-3.5.0-alpha1~211 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5177484f19e6932a5f10fad33eff2fdd1535d1eb;p=thirdparty%2Fopenssl.git Fix ossl_quic_trace to fetch connection short conn id len ossl_quic_trace currently fails to get the connection id when parsing a short header. now that we have an api to get the known length, go ahead and use that to parse the header properly Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/26592) --- diff --git a/ssl/quic/quic_trace.c b/ssl/quic/quic_trace.c index 000f743af0b..e429420e18b 100644 --- a/ssl/quic/quic_trace.c +++ b/ssl/quic/quic_trace.c @@ -10,6 +10,8 @@ #include #include "../ssl_local.h" #include "internal/quic_trace.h" +#include "internal/quic_ssl.h" +#include "internal/quic_channel.h" #include "internal/quic_wire_pkt.h" #include "internal/quic_wire.h" #include "internal/ssl_unwrap.h" @@ -564,6 +566,8 @@ int ossl_quic_trace(int write_p, int version, int content_type, { BIO *bio = arg; PACKET pkt; + size_t id_len = 0; + QUIC_CHANNEL *ch; switch (content_type) { case SSL3_RT_QUIC_DATAGRAM: @@ -584,11 +588,9 @@ int ossl_quic_trace(int write_p, int version, int content_type, if (!PACKET_buf_init(&pkt, buf, msglen)) return 0; /* Decode the packet header */ - /* - * TODO(QUIC SERVER): We need to query the short connection id len - * here, e.g. via some API SSL_get_short_conn_id_len() - */ - if (ossl_quic_wire_decode_pkt_hdr(&pkt, 0, 0, 1, &hdr, NULL, + ch = ossl_quic_conn_get_channel(ssl); + id_len = ossl_quic_channel_get_short_header_conn_id_len(ch); + if (ossl_quic_wire_decode_pkt_hdr(&pkt, id_len, 0, 1, &hdr, NULL, NULL) != 1) return 0;