diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2015-10-28 22:32:17 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-10-30 18:08:06 +0000 |
commit | 9e54fcee5224aef800155514cac5e40d9e38a23e (patch) | |
tree | 15c31219710aa882d6d4a1b5404f46ea31e22cb6 /epan/conversation.c | |
parent | d6dd50b1e33de97ed540efdf984ac1564b9c84ef (diff) |
STUN: register a new conversation dissector after receiving a ConnectionBind Success Response message
According to RFC 6062, once the connection is established, data is sent as-is
To stop the STUN dissector from interfering, add the ability to specify a starting
frame for a conversation dissector and use it
Bug: 11641
Change-Id: I65ca96bddacf70444009c0642ea22173fa68992e
Reviewed-on: https://code.wireshark.org/review/11372
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/conversation.c')
-rw-r--r-- | epan/conversation.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/epan/conversation.c b/epan/conversation.c index ab5cd5e312..f63007a12a 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -172,7 +172,7 @@ conversation_create_from_template(conversation_t *conversation, const address *a * Set the protocol dissector used for the template conversation as * the handler of the new conversation as well. */ - new_conversation_from_template->dissector_handle = conversation->dissector_handle; + new_conversation_from_template->dissector_tree = conversation->dissector_tree; return new_conversation_from_template; } @@ -712,8 +712,7 @@ conversation_new(const guint32 setup_frame, const address *addr1, const address conversation->setup_frame = conversation->last_frame = setup_frame; conversation->data_list = NULL; - /* clear dissector handle */ - conversation->dissector_handle = NULL; + conversation->dissector_tree = wmem_tree_new(wmem_file_scope()); /* set the options and key pointer */ conversation->options = options; @@ -1280,9 +1279,22 @@ conversation_delete_proto_data(conversation_t *conv, const int proto) } void +conversation_set_dissector_from_frame_number(conversation_t *conversation, + const guint32 starting_frame_num, const dissector_handle_t handle) +{ + wmem_tree_insert32(conversation->dissector_tree, starting_frame_num, (void *)handle); +} + +void conversation_set_dissector(conversation_t *conversation, const dissector_handle_t handle) { - conversation->dissector_handle = handle; + conversation_set_dissector_from_frame_number(conversation, 0, handle); +} + +dissector_handle_t +conversation_get_dissector(conversation_t *conversation, const guint32 frame_num) +{ + return (dissector_handle_t)wmem_tree_lookup32_le(conversation->dissector_tree, frame_num); } /* @@ -1307,10 +1319,10 @@ try_conversation_dissector(const address *addr_a, const address *addr_b, const p if (conversation != NULL) { int ret; - if (conversation->dissector_handle == NULL) + dissector_handle_t handle = (dissector_handle_t)wmem_tree_lookup32_le(conversation->dissector_tree, pinfo->fd->num); + if (handle == NULL) return FALSE; - ret=call_dissector_only(conversation->dissector_handle, tvb, pinfo, - tree, data); + ret=call_dissector_only(handle, tvb, pinfo, tree, data); if(!ret) { /* this packet was rejected by the dissector * so return FALSE in case our caller wants |