From 22a7d8fa8d8b8c7171ede55e7f413d004cb7b099 Mon Sep 17 00:00:00 2001 From: Uli Heilmeier Date: Fri, 8 Dec 2017 18:21:04 +0100 Subject: [PATCH] SOCKS: Display right version in pseudo header Use the previous recorded version as version and set field as generated. Bug: 14262 Change-Id: I0872ed826ccd8a5a1b75b071d810404d08ddc7b3 Reviewed-on: https://code.wireshark.org/review/24741 Petri-Dish: Michael Mann Reviewed-by: Michael Mann --- epan/dissectors/packet-socks.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c index f57ea07c66..e2251c6741 100644 --- a/epan/dissectors/packet-socks.c +++ b/epan/dissectors/packet-socks.c @@ -1088,23 +1088,12 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { ti = proto_tree_add_item( tree, proto_socks, tvb, offset, -1, ENC_NA ); socks_tree = proto_item_add_subtree(ti, ett_socks); - if (hash_info->server_port == pinfo->destport) { - if ( hash_info->version == 4) { - display_socks_v4(tvb, offset, pinfo, socks_tree, hash_info, state_info); - } else if ( hash_info->version == 5) { - client_display_socks_v5(tvb, offset, pinfo, socks_tree, hash_info, state_info); - } - } else { - if ( hash_info->version == 4) { - display_socks_v4(tvb, offset, pinfo, socks_tree, hash_info, state_info); - } else if ( hash_info->version == 5) { - server_display_socks_v5(tvb, offset, pinfo, socks_tree, hash_info, state_info); - } - } - /* if past startup, add the faked stuff */ if ( pinfo->num > hash_info->start_done_frame){ /* add info to tree */ + ti = proto_tree_add_uint( socks_tree, hf_socks_ver, tvb, offset, 0, hash_info->version); + PROTO_ITEM_SET_GENERATED(ti); + ti = proto_tree_add_uint( socks_tree, hf_socks_cmd, tvb, offset, 0, hash_info->command); PROTO_ITEM_SET_GENERATED(ti); @@ -1125,6 +1114,20 @@ dissect_socks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { ti = proto_tree_add_uint( socks_tree, hf_socks_dstport, tvb, offset, 0, hash_info->port); PROTO_ITEM_SET_GENERATED(ti); } + } else { + if (hash_info->server_port == pinfo->destport) { + if ( hash_info->version == 4) { + display_socks_v4(tvb, offset, pinfo, socks_tree, hash_info, state_info); + } else if ( hash_info->version == 5) { + client_display_socks_v5(tvb, offset, pinfo, socks_tree, hash_info, state_info); + } + } else { + if ( hash_info->version == 4) { + display_socks_v4(tvb, offset, pinfo, socks_tree, hash_info, state_info); + } else if ( hash_info->version == 5) { + server_display_socks_v5(tvb, offset, pinfo, socks_tree, hash_info, state_info); + } + } } }