HTTP2: reduce duplication of 3GPP session tracking

This commit is contained in:
Joakim Karlsson 2025-06-22 12:36:42 +02:00
parent 1d6402c85e
commit 6404d51adc

View File

@ -2717,6 +2717,24 @@ try_init_stream_with_fake_headers(tvbuff_t* tvb, packet_info* pinfo, http2_sessi
}
}
}
void
dissect_http2_add_assoc_imsi_to_tracked_3gpp_session(tvbuff_t *tvb, proto_tree *http2_tree, http2_stream_info_t *stream_info) {
/* Add Associate IMSI */
if (http2_3gpp_session) {
if(stream_info->imsi && (strcmp(stream_info->imsi, "") != 0)) {
add_assoc_imsi_item(tvb, http2_tree, stream_info->imsi);
} else if (stream_info->referenceid && (strcmp(stream_info->referenceid, "") != 0)) {
char *imsi = NULL;
if((imsi = http2_get_imsi_from_referenceid(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
/* Will try to look up match between path referenceid and location ID */
} else if((imsi = http2_get_imsi_from_location(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
}
}
}
}
#endif
static char*
@ -4034,19 +4052,7 @@ dissect_http2_push_promise(tvbuff_t *tvb, packet_info *pinfo _U_, http2_session_
}
/* Add Associate IMSI */
if (http2_3gpp_session) {
if(stream_info->imsi && (strcmp(stream_info->imsi, "") != 0)) {
add_assoc_imsi_item(tvb, http2_tree, stream_info->imsi);
} else if (stream_info->referenceid && (strcmp(stream_info->referenceid, "") != 0)) {
char *imsi = NULL;
if((imsi = http2_get_imsi_from_referenceid(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
/* Will try to look up match between path referenceid and location ID */
} else if((imsi = http2_get_imsi_from_location(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
}
}
}
dissect_http2_add_assoc_imsi_to_tracked_3gpp_session(tvb, http2_tree, stream_info);
#endif
offset += headlen;
@ -4424,19 +4430,7 @@ dissect_http2_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
http2_stream_info_t *stream_info = get_stream_info_for_id(pinfo, http2_session, false, streamid);
/* Add Associate IMSI */
if (http2_3gpp_session) {
if(stream_info->imsi && (strcmp(stream_info->imsi, "") != 0)) {
add_assoc_imsi_item(tvb, http2_tree, stream_info->imsi);
} else if (stream_info->referenceid && (strcmp(stream_info->referenceid, "") != 0)) {
char *imsi = NULL;
if((imsi = http2_get_imsi_from_referenceid(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
/* Will try to look up match between path referenceid and location ID */
} else if((imsi = http2_get_imsi_from_location(stream_info->referenceid))) {
add_assoc_imsi_item(tvb, http2_tree, imsi);
}
}
}
dissect_http2_add_assoc_imsi_to_tracked_3gpp_session(tvb, http2_tree, stream_info);
#endif
tap_queue_packet(http2_tap, pinfo, http2_stats);