Ethereal-dev: [Ethereal-dev] [Patch] Preference setting for ICMP MPLS extensions
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Brice Augustin <bricecotte@xxxxxxxxx>
Date: Sat, 23 Jul 2005 01:52:11 +0200
Hello, When I realized that my name (and my colleague's, Maria-Luiza) had been removed from the AUTHORS file, I was so scared that I found some motivation, courage and time to code the little patch I promised :) As outlined earlier, our previous patch to decode the ICMP extensions for MPLS couldn't handle the collisions between the IETF draft and RFC 1812. This new patch allows the user to indicate how to decode ICMP payloads that contain an original packet with more than 128 bytes. It adds an "ICMP" panel in the "Edit > Preferences > Protocols" panel, and a checkbox labelled "Favor ICMP extensions for MPLS", not checked by default. If the option is checked, only the first 128 bytes of the original packet are decoded as an IP packet. The end of the payload is decoded as MPLS extensions. Note that, in the case when the original packet has less than 128 bytes, the dissector's behavior is not changed : MPLS extensions are decoded as before. Best regards, Brice Augustin Maria-Luiza Crivat
--- packet-ip.c.ORIGINAL 2005-07-23 01:19:17.000000000 +0200 +++ packet-ip.c 2005-07-23 01:19:17.000000000 +0200 @@ -71,6 +71,10 @@ /* Place IP summary in proto tree */ static gboolean ip_summary_in_tree = TRUE; +/* Decode the end of the ICMP payload as ICMP MPLS extensions +if the packet in the payload has more than 128 bytes */ +static gboolean favor_icmp_mpls_ext = FALSE; + static int proto_ip = -1; static int hf_ip_version = -1; static int hf_ip_hdr_len = -1; @@ -1844,17 +1848,29 @@ /* Decode the IP header and first 64 bits of data from the original datagram. */ next_tvb = tvb_new_subset(tvb, 8, -1, -1); + + /* There is a collision between RFC 1812 and draft-ietf-mpls-icmp-02. + We don't know how to decode the 128th and following bytes of the ICMP payload. + According to draft-ietf-mpls-icmp-02, these bytes should be decoded as MPLS extensions + whereas RFC 1812 tells us to decode them as a portion of the original packet. + Let the user decide. + + Here the user decided to favor MPLS extensions. + Force the IP dissector to decode only the first 128 bytes. */ + if ((tvb_reported_length(tvb) > 8 + 128) && + favor_icmp_mpls_ext && (tvb_get_ntohs(tvb, 8 + 2) > 128)) + set_actual_length(next_tvb, 128); + call_dissector(ip_handle, next_tvb, pinfo, icmp_tree); /* Restore the "we're inside an error packet" flag. */ pinfo->in_error_pkt = save_in_error_pkt; - /* MPLS extensions */ - /* XXX - this doesn't handle ICMP packets with more than - 128 bytes of the original datagram, which RFC 1812 doesn't - disallow. Make whether to handle MPLS extensions a - preference setting? */ - if (tvb_reported_length(tvb) > 8 + 128) + /* Decode MPLS extensions if the payload has at least 128 bytes, and + - the original packet in the ICMP payload has less than 128 bytes, or + - the user favors the MPLS extensions analysis */ + if ((tvb_reported_length(tvb) > 8 + 128) + && (tvb_get_ntohs(tvb, 8 + 2) <= 128 || favor_icmp_mpls_ext)) dissect_mpls_extensions(tvb, 8 + 128, icmp_tree); break; @@ -2293,11 +2309,20 @@ &ett_icmp_mpls_object, &ett_icmp_mpls_stack_object }; - + + module_t *icmp_module; + proto_icmp = proto_register_protocol("Internet Control Message Protocol", "ICMP", "icmp"); proto_register_field_array(proto_icmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + icmp_module = prefs_register_protocol(proto_icmp, NULL); + + prefs_register_bool_preference(icmp_module, "favor_icmp_mpls", + "Favor ICMP extensions for MPLS", + "Whether the 128th and following bytes of the ICMP payload should be decoded as MPLS extensions or as a portion of the original packet", + &favor_icmp_mpls_ext); } void
- Follow-Ups:
- [Ethereal-dev] Re: Preference setting for ICMP MPLS extensions
- From: ronnie sahlberg
- [Ethereal-dev] Re: Preference setting for ICMP MPLS extensions
- Prev by Date: SV: [Ethereal-dev] Update to Microsoft MMS dissector
- Next by Date: [Ethereal-dev] Re: Preference setting for ICMP MPLS extensions
- Previous by thread: SV: [Ethereal-dev] Update to Microsoft MMS dissector
- Next by thread: [Ethereal-dev] Re: Preference setting for ICMP MPLS extensions
- Index(es):
- Get Wireshark
- Download
- Code of Conduct