diff options
author | John Thacker <johnthacker@gmail.com> | 2023-05-26 22:22:22 -0400 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2023-05-27 19:26:44 -0400 |
commit | 91cbf179bf890413bb6ff3152c163cd6a3fa0d37 (patch) | |
tree | 7eed75a4e0a4566c0a53492f40be05c54fdf8e01 | |
parent | 875e77d78474a505bafe5a94cfb4a8e94794453e (diff) |
kafka: Allow reused correlation IDs on a connection
Allow reused correlation IDs in the same connection by using
a multimap, since apparently that's possible. (This still doesn't
help you if you have an out of order capture such that you have
multiple requests with the same ID before any responses.)
Fix #19021
-rw-r--r-- | epan/dissectors/packet-kafka.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c index bca720ffa2..20eb978f70 100644 --- a/epan/dissectors/packet-kafka.c +++ b/epan/dissectors/packet-kafka.c @@ -8804,15 +8804,15 @@ dissect_kafka_offset_delete_response(tvbuff_t *tvb, packet_info *pinfo, proto_tr /* MAIN */ -static wmem_tree_t * +static wmem_multimap_t * dissect_kafka_get_match_map(packet_info *pinfo) { conversation_t *conversation; - wmem_tree_t *match_map; + wmem_multimap_t *match_map; conversation = find_or_create_conversation(pinfo); - match_map = (wmem_tree_t *) conversation_get_proto_data(conversation, proto_kafka); + match_map = (wmem_multimap_t *) conversation_get_proto_data(conversation, proto_kafka); if (match_map == NULL) { - match_map = wmem_tree_new(wmem_file_scope()); + match_map = wmem_multimap_new(wmem_file_scope(), g_direct_hash, g_direct_equal); conversation_add_proto_data(conversation, proto_kafka, match_map); } @@ -8822,17 +8822,17 @@ dissect_kafka_get_match_map(packet_info *pinfo) static gboolean dissect_kafka_insert_match(packet_info *pinfo, guint32 correlation_id, kafka_query_response_t *match) { - if (wmem_tree_lookup32(dissect_kafka_get_match_map(pinfo), correlation_id)) { + if (wmem_multimap_lookup32(dissect_kafka_get_match_map(pinfo), GUINT_TO_POINTER(correlation_id), pinfo->num)) { return 0; } - wmem_tree_insert32(dissect_kafka_get_match_map(pinfo), correlation_id, match); + wmem_multimap_insert32(dissect_kafka_get_match_map(pinfo), GUINT_TO_POINTER(correlation_id), pinfo->num, match); return 1; } static kafka_query_response_t * dissect_kafka_lookup_match(packet_info *pinfo, guint32 correlation_id) { - kafka_query_response_t *match = (kafka_query_response_t*)wmem_tree_lookup32(dissect_kafka_get_match_map(pinfo), correlation_id); + kafka_query_response_t *match = (kafka_query_response_t*)wmem_multimap_lookup32_le(dissect_kafka_get_match_map(pinfo), GUINT_TO_POINTER(correlation_id), pinfo->num); return match; } |