forked from osmocom/wireshark
QUIC: improve migration support
We should keep track of CID reported in Preferred Address Transport Parameter
Close #16915
(cherry picked from commit a175435c0a
)
This commit is contained in:
parent
2714dd9e6f
commit
ba9ae589ad
|
@ -245,17 +245,6 @@ typedef struct quic_decrypt_result {
|
|||
guint data_len; /**< Size of decrypted data. */
|
||||
} quic_decrypt_result_t;
|
||||
|
||||
/*
|
||||
* Although the QUIC SCID/DCID length field can store at most 255, v1 limits the
|
||||
* CID length to 20.
|
||||
*/
|
||||
#define QUIC_MAX_CID_LENGTH 20
|
||||
|
||||
typedef struct quic_cid {
|
||||
guint8 len;
|
||||
guint8 cid[QUIC_MAX_CID_LENGTH];
|
||||
} quic_cid_t;
|
||||
|
||||
/** QUIC decryption context. */
|
||||
typedef struct quic_cipher {
|
||||
// TODO hp_cipher does not change after KeyUpdate, but is still tied to the
|
||||
|
@ -2524,6 +2513,22 @@ quic_verify_retry_token(tvbuff_t *tvb, quic_packet_info_t *quic_packet, const qu
|
|||
}
|
||||
#endif /* HAVE_LIBGCRYPT_AEAD */
|
||||
|
||||
void
|
||||
quic_add_connection(packet_info *pinfo, const quic_cid_t *cid)
|
||||
{
|
||||
#ifdef HAVE_LIBGCRYPT_AEAD
|
||||
quic_datagram *dgram_info;
|
||||
|
||||
dgram_info = (quic_datagram *)p_get_proto_data(wmem_file_scope(), pinfo, proto_quic, 0);
|
||||
if (dgram_info && dgram_info->conn) {
|
||||
quic_connection_add_cid(dgram_info->conn, cid, dgram_info->from_server);
|
||||
}
|
||||
#else
|
||||
(void)pinfo;
|
||||
(void)cid;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
quic_add_connection_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, quic_info_data_t *conn)
|
||||
{
|
||||
|
|
|
@ -30,6 +30,17 @@ typedef struct _quic_stream_info {
|
|||
gboolean from_server;
|
||||
} quic_stream_info;
|
||||
|
||||
/*
|
||||
* Although the QUIC SCID/DCID length field can store at most 255, v1 limits the
|
||||
* CID length to 20.
|
||||
*/
|
||||
#define QUIC_MAX_CID_LENGTH 20
|
||||
|
||||
typedef struct quic_cid {
|
||||
guint8 len;
|
||||
guint8 cid[QUIC_MAX_CID_LENGTH];
|
||||
} quic_cid_t;
|
||||
|
||||
/**
|
||||
* Obtain Stream Type from a Stream ID.
|
||||
* https://tools.ietf.org/html/draft-ietf-quic-transport-23#section-2.1
|
||||
|
@ -62,6 +73,9 @@ dissect_gquic_frame_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gquic_tr
|
|||
guint32
|
||||
dissect_gquic_tags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ft_tree, guint offset);
|
||||
|
||||
void
|
||||
quic_add_connection(packet_info *pinfo, const quic_cid_t *cid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -7443,6 +7443,7 @@ ssl_dissect_hnd_hello_ext_quic_transport_parameters(ssl_common_dissect_t *hf, tv
|
|||
break;
|
||||
case SSL_HND_QUIC_TP_PREFERRED_ADDRESS: {
|
||||
guint32 connectionid_length;
|
||||
quic_cid_t cid;
|
||||
|
||||
proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_pa_ipv4address,
|
||||
tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
|
@ -7465,6 +7466,11 @@ ssl_dissect_hnd_hello_ext_quic_transport_parameters(ssl_common_dissect_t *hf, tv
|
|||
|
||||
proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_pa_connectionid,
|
||||
tvb, offset, connectionid_length, ENC_NA);
|
||||
if (connectionid_length >= 1 && connectionid_length <= QUIC_MAX_CID_LENGTH) {
|
||||
cid.len = connectionid_length;
|
||||
tvb_memcpy(tvb, cid.cid, offset, connectionid_length);
|
||||
quic_add_connection(pinfo, &cid);
|
||||
}
|
||||
offset += connectionid_length;
|
||||
|
||||
proto_tree_add_item(parameter_tree, hf->hf.hs_ext_quictp_parameter_pa_statelessresettoken,
|
||||
|
|
Loading…
Reference in New Issue