From 6af7425ceebb698c53368fa90e1be52338bdf333 Mon Sep 17 00:00:00 2001 From: Mirko Parthey Date: Mon, 2 Jan 2017 13:45:24 +0100 Subject: ISAKMP: fix dissection of IKEv2 ID Payload Fix dissection of the IKEv2 Identification Payload. Unlike IKEv1, it does not have Protocol and Port fields. References: * RFC 2407, section 4.6.2 * RFC 7296, section 3.5 Change-Id: I968e378abd49363785dd7308a4f27908c1c05a8a Reviewed-on: https://code.wireshark.org/review/19497 Reviewed-by: Alexis La Goutte --- epan/dissectors/packet-isakmp.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index 432cd89b6f..e1a0c66e22 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -4086,26 +4086,32 @@ dissect_id(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_v offset += 1; length -= 1; - protocol_id= tvb_get_guint8(tvb, offset); - if (protocol_id == 0) - proto_tree_add_uint_format_value(tree, hf_isakmp_id_protoid, tvb, offset,1, - protocol_id, "Unused"); - else - proto_tree_add_item(tree, hf_isakmp_id_protoid, tvb, offset, 1, ENC_BIG_ENDIAN); + if (isakmp_version == 1) { + protocol_id = tvb_get_guint8(tvb, offset); + if (protocol_id == 0) + proto_tree_add_uint_format_value(tree, hf_isakmp_id_protoid, tvb, offset, 1, + protocol_id, "Unused"); + else + proto_tree_add_item(tree, hf_isakmp_id_protoid, tvb, offset, 1, ENC_BIG_ENDIAN); - offset += 1; - length -= 1; + offset += 1; + length -= 1; - port = tvb_get_ntohs(tvb, offset); - if (port == 0) - proto_tree_add_uint_format_value(tree, hf_isakmp_id_port, tvb, offset, 2, - port, "Unused"); - else - proto_tree_add_item(tree, hf_isakmp_id_port, tvb, offset, 2, ENC_BIG_ENDIAN); + port = tvb_get_ntohs(tvb, offset); + if (port == 0) + proto_tree_add_uint_format_value(tree, hf_isakmp_id_port, tvb, offset, 2, + port, "Unused"); + else + proto_tree_add_item(tree, hf_isakmp_id_port, tvb, offset, 2, ENC_BIG_ENDIAN); - offset += 2; - length -= 2; + offset += 2; + length -= 2; + } else if (isakmp_version == 2) { + /* Reserved */ + offset += 3; + length -= 3; + } /* * It shows strings of all types though some of types are not -- cgit v1.2.3