diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:33 +0000 |
commit | 9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch) | |
tree | 2784370cda9bbf2da9114d70f05399c0b229d28c /epan/follow.c | |
parent | Adding debian version 4.2.6-1. (diff) | |
download | wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/follow.c')
-rw-r--r-- | epan/follow.c | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/epan/follow.c b/epan/follow.c index 84203712..5d9a75d8 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -32,7 +32,7 @@ struct register_follow { follow_sub_stream_id_func sub_stream_id; /* sub-stream id, used for UI */ }; -static wmem_tree_t *registered_followers = NULL; +static wmem_tree_t *registered_followers; void register_follow_stream(const int proto_id, const char* tap_listener, follow_conv_filter_func conv_filter, follow_index_filter_func index_filter, follow_address_filter_func address_filter, @@ -131,12 +131,12 @@ register_follow_t* get_follow_by_proto_id(const int proto_id) return (register_follow_t*)wmem_tree_lookup_string(registered_followers, proto_get_protocol_short_name(protocol), 0); } -void follow_iterate_followers(wmem_foreach_func func, gpointer user_data) +void follow_iterate_followers(wmem_foreach_func func, void *user_data) { wmem_tree_foreach(registered_followers, func, user_data); } -gchar* follow_get_stat_tap_string(register_follow_t* follower) +char* follow_get_stat_tap_string(register_follow_t* follower) { GString *cmd_str = g_string_new("follow,"); g_string_append(cmd_str, proto_get_protocol_filter_name(follower->proto_id)); @@ -149,54 +149,60 @@ gchar* follow_get_stat_tap_string(register_follow_t* follower) void follow_reset_stream(follow_info_t* info) { + GList *cur; + follow_record_t *follow_record; + info->bytes_written[0] = info->bytes_written[1] = 0; info->client_port = 0; info->server_port = 0; - info->client_ip.type = FT_NONE; - info->client_ip.len = 0; - info->server_ip.type = FT_NONE; - info->server_ip.len = 0; - info->fragments[0] = info->fragments[1] = NULL; - info->seq[0] = info->seq[1] = 0; - info->substream_id = SUBSTREAM_UNUSED; -} -void -follow_info_free(follow_info_t* follow_info) -{ - GList *cur; - follow_record_t *follow_record; + free_address(&info->client_ip); + free_address(&info->server_ip); - for (cur = follow_info->payload; cur; cur = g_list_next(cur)) { - if(cur->data) { - follow_record = (follow_record_t *)cur->data; - if(follow_record->data) - g_byte_array_free(follow_record->data, TRUE); + for (cur = info->payload; cur; cur = g_list_next(cur)) { + follow_record = (follow_record_t *)cur->data; + if(follow_record->data) + g_byte_array_free(follow_record->data, true); - g_free(follow_record); - } + g_free(follow_record); } - g_list_free(follow_info->payload); + g_list_free(info->payload); + info->payload = NULL; //Only TCP stream uses fragments - for (cur = follow_info->fragments[0]; cur; cur = g_list_next(cur)) { + for (cur = info->fragments[0]; cur; cur = g_list_next(cur)) { follow_record = (follow_record_t *)cur->data; if(follow_record->data) { - g_byte_array_free(follow_record->data, TRUE); + g_byte_array_free(follow_record->data, true); } g_free(follow_record); } - for (cur = follow_info->fragments[1]; cur; cur = g_list_next(cur)) { + for (cur = info->fragments[1]; cur; cur = g_list_next(cur)) { follow_record = (follow_record_t *)cur->data; if(follow_record->data) { - g_byte_array_free(follow_record->data, TRUE); + g_byte_array_free(follow_record->data, true); } g_free(follow_record); } + info->fragments[0] = info->fragments[1] = NULL; + info->seq[0] = info->seq[1] = 0; + + g_free(info->filter_out_filter); + info->filter_out_filter = NULL; - free_address(&follow_info->client_ip); - free_address(&follow_info->server_ip); - g_free(follow_info->filter_out_filter); + /* Don't reset the substream_id - that's used by followers for + * for determining which tvbs match, and we don't want to clear + * it when the taps are reset due to a retap. + */ +#if 0 + info->substream_id = SUBSTREAM_UNUSED; +#endif +} + +void +follow_info_free(follow_info_t* follow_info) +{ + follow_reset_stream(follow_info); g_free(follow_info); } @@ -225,9 +231,9 @@ follow_tvb_tap_listener(void *tapdata, packet_info *pinfo, } if (addresses_equal(&follow_info->client_ip, &pinfo->src) && follow_info->client_port == pinfo->srcport) - follow_record->is_server = FALSE; + follow_record->is_server = false; else - follow_record->is_server = TRUE; + follow_record->is_server = true; /* update stream counter */ follow_info->bytes_written[follow_record->is_server] += follow_record->data->len; |