aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ip.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-12-16 20:06:11 -0500
committerAnders Broman <a.broman58@gmail.com>2016-12-31 07:31:42 +0000
commitf4b0abc7296bbb431e64e31f85b24c29196c2ae4 (patch)
tree68394f5fdfa1987900f0b079d0ecfd34003e8a5a /epan/dissectors/packet-ip.c
parent13964595ad09e5d1115f6c5cb604cded27f9f55d (diff)
Dissectors don't need a journey of self discovery.
They already know who they are when they register themselves. Saving the handle then to avoid finding it later. Not sure if this will increase unnecessary register_dissector functions (instead of using create_dissector_handle in proto_reg_handoff function) when other dissectors copy/paste, but it should make startup time a few microseconds better. Change-Id: I3839be791b32b84887ac51a6a65fb5733e9f1f43 Reviewed-on: https://code.wireshark.org/review/19481 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-ip.c')
-rw-r--r--epan/dissectors/packet-ip.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 8961c96e89..444c2dac86 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -262,6 +262,7 @@ static expert_field ei_ip_ttl_too_small = EI_INIT;
static expert_field ei_ip_cipso_tag = EI_INIT;
static expert_field ei_ip_bogus_ip_version = EI_INIT;
+static dissector_handle_t ip_handle;
#ifdef HAVE_GEOIP
static gint ett_geoip_info = -1;
@@ -3120,7 +3121,7 @@ proto_register_ip(void)
"Try to decode a packet using an heuristic sub-dissector before using a sub-dissector registered to a specific port",
&try_heuristic_first);
- register_dissector("ip", dissect_ip, proto_ip);
+ ip_handle = register_dissector("ip", dissect_ip, proto_ip);
register_init_routine(ip_defragment_init);
register_cleanup_routine(ip_defragment_cleanup);
ip_tap = register_tap("ip");
@@ -3135,12 +3136,10 @@ proto_register_ip(void)
void
proto_reg_handoff_ip(void)
{
- dissector_handle_t ip_handle;
dissector_handle_t ipv4_handle;
capture_dissector_handle_t clip_cap_handle;
int proto_clip;
- ip_handle = find_dissector("ip");
ipv6_handle = find_dissector("ipv6");
ipv4_handle = create_dissector_handle(dissect_ip_v4, proto_ip);