aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2016-03-11 20:54:26 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2016-03-13 10:51:44 +0000
commit6f220a343e476fb1df1f98c719b0fedf5c4f8c7f (patch)
treecf194b9f75ad4075bef39b2fb082bcb26ab552a4 /epan/wslua
parentb46d55551fbdab486b2142f393b13c56f2ff3204 (diff)
Lua: Remove heur dissectors when reload Lua plugins
When reloading Lua plugins all registered heuristic dissectors must be removed. Bug: 12251 Change-Id: Ib7da6df347fb9294f5394ae531b582bf6d2730bb Reviewed-on: https://code.wireshark.org/review/14429 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/init_wslua.c1
-rw-r--r--epan/wslua/wslua.h1
-rw-r--r--epan/wslua/wslua_proto.c16
3 files changed, 18 insertions, 0 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 2141dcb947..beacff4f9e 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -978,6 +978,7 @@ void wslua_reload_plugins (register_cb cb, gpointer client_data) {
if (ops->close_dialogs)
ops->close_dialogs();
+ wslua_deregister_heur_dissectors(L);
wslua_deregister_protocols(L);
wslua_deregister_dissector_tables(L);
wslua_deregister_listeners(L);
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 05c1fa3884..aee0abfda8 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -783,6 +783,7 @@ extern int luaopen_rex_glib(lua_State *L);
extern const gchar* get_current_plugin_version(void);
extern void clear_current_plugin_version(void);
+extern int wslua_deregister_heur_dissectors(lua_State* L);
extern int wslua_deregister_protocols(lua_State* L);
extern int wslua_deregister_dissector_tables(lua_State* L);
extern int wslua_deregister_listeners(lua_State* L);
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c
index bac94d4f46..05131146b5 100644
--- a/epan/wslua/wslua_proto.c
+++ b/epan/wslua/wslua_proto.c
@@ -583,6 +583,22 @@ ProtoField wslua_is_field_available(lua_State* L, const char* field_abbr) {
return NULL;
}
+int wslua_deregister_heur_dissectors(lua_State* L) {
+ /* for each registered heur dissector do... */
+ lua_rawgeti(L, LUA_REGISTRYINDEX, lua_heur_dissectors_table_ref);
+ for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
+ const gchar *listname = luaL_checkstring(L, -2);
+ for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
+ const gchar *proto_name = luaL_checkstring(L, -2);
+ int proto_id = proto_get_id_by_short_name(proto_name);
+ heur_dissector_delete(listname, heur_dissect_lua, proto_id);
+ }
+ }
+ lua_pop(L, 1); /* lua_heur_dissectors_table_ref */
+
+ return 0;
+}
+
int wslua_deregister_protocols(lua_State* L) {
/* for each registered Proto protocol do... */
lua_rawgeti(L, LUA_REGISTRYINDEX, protocols_table_ref);