aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2019-01-01 12:45:46 -0500
committerAnders Broman <a.broman58@gmail.com>2019-01-02 08:27:57 +0000
commite307c703fb5eef509123aa9b7bd035a511e202b9 (patch)
tree28d2549f3542d1023bba58e5d845866ce89c7731 /epan
parentee231105cc73ddcc8fc296915c2b626965439d17 (diff)
Make dissect_icmp_extension_structure into a dissector function.
That way there isn't a need for packet-icmp-int.h. Change-Id: Ib523c36ab2fdf6a43ee6ff32dadfcd53e9d9bf14 Reviewed-on: https://code.wireshark.org/review/31290 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-icmp-int.h16
-rw-r--r--epan/dissectors/packet-icmp.c12
-rw-r--r--epan/dissectors/packet-icmpv6.c7
3 files changed, 13 insertions, 22 deletions
diff --git a/epan/dissectors/packet-icmp-int.h b/epan/dissectors/packet-icmp-int.h
deleted file mode 100644
index 6ea48be96a..0000000000
--- a/epan/dissectors/packet-icmp-int.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* packet-icmp-int.h
- * Functions which are shared between ICMPv4 and ICMPv6
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef __PACKET_ICMP_INT_H__
-#define __PACKET_ICMP_INT_H__
-
-
-gint dissect_icmp_extension_structure(tvbuff_t * tvb, packet_info *pinfo, gint offset, proto_tree * tree);
-#endif
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index b0f1912f7e..3b744f5f93 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -39,7 +39,6 @@
#include "packet-ip.h"
#include "packet-icmp.h"
-#include "packet-icmp-int.h"
void proto_register_icmp(void);
void proto_reg_handoff_icmp(void);
@@ -942,8 +941,10 @@ dissect_interface_identification_object(tvbuff_t * tvb, gint offset,
} /*end dissect_interface_identification_object */
-gint dissect_icmp_extension_structure(tvbuff_t * tvb, packet_info *pinfo, gint offset, proto_tree * tree)
+static int
+dissect_icmp_extension(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
{
+ int offset = 0;
guint8 version;
guint8 class_num;
guint8 c_type;
@@ -1664,7 +1665,8 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
if ((tvb_reported_length(tvb) > 8 + 128)
&& (tvb_get_ntohs(tvb, 8 + 2) <= 128
|| favor_icmp_mpls_ext)) {
- dissect_icmp_extension_structure(tvb, pinfo, 8 + 128, icmp_tree);
+ tvbuff_t * extension_tvb = tvb_new_subset_remaining(tvb, 8 + 128);
+ dissect_icmp_extension(extension_tvb, pinfo, icmp_tree, NULL);
}
break;
case ICMP_ECHOREPLY:
@@ -1800,7 +1802,8 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
case ICMP_EXTECHO:
if (tvb_reported_length(tvb) > 8) {
- dissect_icmp_extension_structure(tvb, pinfo, 8, icmp_tree);
+ tvbuff_t * extension_tvb = tvb_new_subset_remaining(tvb, 8);
+ dissect_icmp_extension(extension_tvb, pinfo, icmp_tree, NULL);
}
break;
}
@@ -2311,6 +2314,7 @@ void proto_register_icmp(void)
register_seq_analysis("icmp", "ICMP Flows", proto_icmp, NULL, TL_REQUIRES_COLUMNS, icmp_seq_analysis_packet);
icmp_handle = register_dissector("icmp", dissect_icmp, proto_icmp);
+ register_dissector("icmp_extension", dissect_icmp_extension, proto_icmp);
icmp_tap = register_tap("icmp");
}
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index 55b6f22844..c82a283141 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -41,7 +41,6 @@
#include "packet-x509af.h"
#include "packet-x509if.h"
#include "packet-icmp.h" /* same transaction_t used both both v4 and v6 */
-#include "packet-icmp-int.h"
#include "packet-ieee802154.h"
#include "packet-6lowpan.h"
#include "packet-ip.h"
@@ -625,6 +624,7 @@ static expert_field ei_icmpv6_rpl_p2p_dro_zero = EI_INIT;
static dissector_handle_t icmpv6_handle;
static dissector_handle_t ipv6_handle;
+static dissector_handle_t icmp_extension_handle;
#define ICMP6_DST_UNREACH 1
#define ICMP6_PACKET_TOO_BIG 2
@@ -4622,7 +4622,9 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
proto_tree_add_item(icmp6_tree, hf_icmpv6_ext_echo_req_local, tvb, offset, 1,
ENC_BIG_ENDIAN);
offset += 1;
- offset = dissect_icmp_extension_structure(tvb, pinfo, offset, icmp6_tree);
+
+ tvbuff_t * extension_tvb = tvb_new_subset_remaining(tvb, offset);
+ offset += call_dissector(icmp_extension_handle, extension_tvb, pinfo, icmp6_tree);
break;
}
@@ -6088,6 +6090,7 @@ proto_reg_handoff_icmpv6(void)
* Get a handle for the IPv6 dissector.
*/
ipv6_handle = find_dissector_add_dependency("ipv6", proto_icmpv6);
+ icmp_extension_handle = find_dissector("icmp_extension");
}
/*