aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ipvs-syncd.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-06-14 16:15:20 -0400
committerAndersBroman <a.broman58@gmail.com>2023-06-14 21:24:16 +0000
commit5d0f253d231af57bffbb92624444ab78322e6374 (patch)
tree474ef6a1de2f714996678e40110a6d5b11f078ad /epan/dissectors/packet-ipvs-syncd.c
parent04d621ba22c3ee5837cba81c63a485de9fa1b4fb (diff)
Use `register_dissector()` for more protocols
Changes several calls of `create_dissector_handle()` to instead call `register_dissector()` with a name for the dissector. This should handle all dissectors in `epan/` from `packet-g*` to `packet-i*`. This change allows affected dissectors to be findable by calls to `find_dissector()`. In turn, this opens up more command-line use for these protocols, including fuzzshark and rawshark, as well as lua use via `Dissector.get()`. Where needed, move the call from the protocol handoff function to the protocol register function, save the result in a static variable, and use that variable in the handoff function. There were some calls to `create_dissector_handle()` or `register_dissector()` which passed `-1` as the protocol argument. When I saw those I corrected them to pass the actual `proto_foo` identifier instead. Partially addresses #5612
Diffstat (limited to 'epan/dissectors/packet-ipvs-syncd.c')
-rw-r--r--epan/dissectors/packet-ipvs-syncd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ipvs-syncd.c b/epan/dissectors/packet-ipvs-syncd.c
index cb4e99759b..e8a1200346 100644
--- a/epan/dissectors/packet-ipvs-syncd.c
+++ b/epan/dissectors/packet-ipvs-syncd.c
@@ -15,6 +15,8 @@
void proto_register_ipvs_syncd(void);
void proto_reg_handoff_ipvs_syncd(void);
+static dissector_handle_t ipvs_syncd_handle;
+
static int proto_ipvs_syncd = -1;
static int hf_conn_count = -1;
static int hf_syncid = -1;
@@ -460,14 +462,13 @@ proto_register_ipvs_syncd(void)
proto_ipvs_syncd = proto_register_protocol("IP Virtual Services Sync Daemon", "IPVS", "ipvs");
proto_register_field_array(proto_ipvs_syncd, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ ipvs_syncd_handle = register_dissector("ipvs", dissect_ipvs_syncd, proto_ipvs_syncd);
}
void
proto_reg_handoff_ipvs_syncd(void)
{
- dissector_handle_t ipvs_syncd_handle;
-
- ipvs_syncd_handle = create_dissector_handle(dissect_ipvs_syncd, proto_ipvs_syncd);
dissector_add_uint_with_preference("udp.port", IPVS_SYNCD_PORT, ipvs_syncd_handle);
}