aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-vrrp.c
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-09-19 14:12:28 -0400
committerAndersBroman <a.broman58@gmail.com>2023-09-19 19:06:51 +0000
commitfb9d01556dbc28a507778f66cbaca234a55e6305 (patch)
tree6bd4e8351e33d1519492b96ae9baf69eef6ee678 /epan/dissectors/packet-vrrp.c
parentd4f47c60b7eb12a84348d5c0228f6b5afd013660 (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-p*` to `packet-v*`. 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-vrrp.c')
-rw-r--r--epan/dissectors/packet-vrrp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/epan/dissectors/packet-vrrp.c b/epan/dissectors/packet-vrrp.c
index c158d6c085..b12677137b 100644
--- a/epan/dissectors/packet-vrrp.c
+++ b/epan/dissectors/packet-vrrp.c
@@ -24,6 +24,8 @@
void proto_register_vrrp(void);
void proto_reg_handoff_vrrp(void);
+static dissector_handle_t vrrp_handle;
+
static gint proto_vrrp = -1;
static gint ett_vrrp = -1;
static gint ett_vrrp_ver_type = -1;
@@ -317,6 +319,8 @@ void proto_register_vrrp(void)
proto_register_field_array(proto_vrrp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ vrrp_handle = register_dissector("vrrp", dissect_vrrp, proto_vrrp);
+
expert_vrrp = expert_register_protocol(proto_vrrp);
expert_register_field_array(expert_vrrp, ei, array_length(ei));
@@ -327,16 +331,11 @@ void proto_register_vrrp(void)
"There is some ambiguity on how to calculate V3 checksums"
"As in V3 will use a pseudo header(which may only be implemented for IPv6 by some manufacturers)",
&g_vrrp_v3_checksum_as_in_v2);
-
-
}
void
proto_reg_handoff_vrrp(void)
{
- dissector_handle_t vrrp_handle;
-
- vrrp_handle = create_dissector_handle(dissect_vrrp, proto_vrrp);
dissector_add_uint("ip.proto", IP_PROTO_VRRP, vrrp_handle);
}