ICMP: fix parameter problem parsing

ICMP parameter problem has a pointer field where others have an unused
field. This change excludes the pointer field from the unused field.
Also clear up some comments related to code for RFC 4884.

Change-Id: I91569e096901cf8d59b8319adb1fed1248f93b5e
Reviewed-on: https://code.wireshark.org/review/35102
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jaap Keuter 2019-11-16 13:06:07 +01:00 committed by Anders Broman
parent 7af41845a5
commit 285cb7507a
1 changed files with 3 additions and 7 deletions

View File

@ -1398,8 +1398,8 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
/* To do: check for runts, errs, etc. */
icmp_type = tvb_get_guint8(tvb, 0);
icmp_code = tvb_get_guint8(tvb, 1);
/*length of original datagram carried in the ICMP payload. In terms of 32 bit
* words.*/
/* RFC 4884: Length of original datagram carried in the ICMP payload,
* or 0 otherwise. Length in terms of 32 bit words.*/
icmp_original_dgram_length = tvb_get_guint8(tvb, 5);
type_str =
@ -1521,9 +1521,6 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
break;
case ICMP_UNREACH:
/* If icmp_original_dgram_length > 0, then this packet is compliant with RFC 4884 and
* interpret the 6th octet as length of the original datagram
*/
if (icmp_original_dgram_length > 0) {
proto_tree_add_item(icmp_tree, hf_icmp_unused, tvb, 4, 1, ENC_NA);
proto_tree_add_item(icmp_tree, hf_icmp_length, tvb, 5, 1, ENC_BIG_ENDIAN);
@ -1553,14 +1550,13 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
case ICMP_PARAMPROB:
proto_tree_add_item(icmp_tree, hf_icmp_pointer, tvb, 4, 1, ENC_BIG_ENDIAN);
if (icmp_original_dgram_length > 0) {
proto_tree_add_item(icmp_tree, hf_icmp_unused, tvb, 4, 1, ENC_NA);
proto_tree_add_item(icmp_tree, hf_icmp_length, tvb, 5, 1, ENC_BIG_ENDIAN);
ti = proto_tree_add_uint(icmp_tree, hf_icmp_length_original_datagram,
tvb, 5, 1, icmp_original_dgram_length * 4);
proto_item_set_generated(ti);
proto_tree_add_item(icmp_tree, hf_icmp_unused, tvb, 6, 2, ENC_NA);
} else {
proto_tree_add_item(icmp_tree, hf_icmp_unused, tvb, 4, 4, ENC_NA);
proto_tree_add_item(icmp_tree, hf_icmp_unused, tvb, 5, 3, ENC_NA);
}
break;