diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2016-06-13 15:28:16 -0400 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2016-06-15 05:38:01 +0000 |
commit | 3a590217ac60d626cb126aff593b43901585224c (patch) | |
tree | 0e75c2b174f6ef9ee1b5837c60cffe9d0515519b /epan/dissectors/packet-radius.c | |
parent | 22fd85d178e52b23a192737f16957d24886d0a5d (diff) |
Change how dissectors do late-field-registration to avoid a double-registration
assertion.
If a dissector forces registration of fields during dissection it needs to do
so in a way that clears the prefix registration. Otherwise epan will call the
registration routine a 2nd time (which will cause us to assert out) if a user
types a display filter (with the dissector's prefix) that doesn't exist.
Update the proto_register_prefix() comments to reflect this.
Change-Id: I3ce29243395fb55192bb5dfd950baa88410ac136
Reviewed-on: https://code.wireshark.org/review/15881
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Diffstat (limited to 'epan/dissectors/packet-radius.c')
-rw-r--r-- | epan/dissectors/packet-radius.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index babba057c5..6202f162e0 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -1357,8 +1357,6 @@ vsa_buffer_table_destroy(void *table) } } -static void register_radius_fields(const char *); - void dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset, guint length) { @@ -1373,7 +1371,7 @@ dissect_attribute_value_pairs(proto_tree *tree, packet_info *pinfo, tvbuff_t *tv GHashTable *vsa_buffer_table = NULL; if (hf_radius_code == -1) - register_radius_fields(""); + proto_registrar_get_byname("radius.code"); /* * In case we throw an exception, clean up whatever stuff we've @@ -1847,7 +1845,7 @@ dissect_radius(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ /* Load header fields if not already done */ if (hf_radius_code == -1) - register_radius_fields(""); + proto_registrar_get_byname("radius.code"); ti = proto_tree_add_item(tree, proto_radius, tvb, 0, rh.rh_pktlength, ENC_NA); radius_tree = proto_item_add_subtree(ti, ett_radius); @@ -2371,7 +2369,9 @@ radius_init_protocol(void) radius_calls = wmem_map_new(wmem_file_scope(), radius_call_hash, radius_call_equal); } -static void register_radius_fields(const char *unused _U_) { +static void +register_radius_fields(const char *unused _U_) +{ hf_register_info base_hf[] = { { &hf_radius_req, { "Request", "radius.req", FT_BOOLEAN, BASE_NONE, NULL, 0x0, |