aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2013-02-25 17:32:25 +0000
committerMichael Mann <mmann78@netscape.net>2013-02-25 17:32:25 +0000
commit0f3f207967a99f2d101f80d1d878d33e30c1b52e (patch)
treee11bfbf1470d7ac7b2f318b57faafb1275e3e9b2 /epan/wslua
parentd7b294a17f165cfb85a5728dc3dc600872a412bb (diff)
Bugfix Lua pinfo.cols.protocol not holding value in postdissector
From Hadriel Kaplan, bug 6020 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6020) svn path=/trunk/; revision=47877
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/wslua.h1
-rw-r--r--epan/wslua/wslua_field.c19
2 files changed, 19 insertions, 1 deletions
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 3a38d0b943..0d9383d3e1 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -420,6 +420,7 @@ extern int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void
extern void proto_register_lua(void);
extern GString* lua_register_all_taps(void);
+extern void wslua_prime_dfilter(epan_dissect_t *edt);
extern void lua_prime_all_fields(proto_tree* tree);
extern int Proto_commit(lua_State* L);
diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c
index 92a9bee16f..7aa1a8f306 100644
--- a/epan/wslua/wslua_field.c
+++ b/epan/wslua/wslua_field.c
@@ -379,9 +379,23 @@ WSLUA_FUNCTION wslua_all_field_infos(lua_State* L) {
WSLUA_CLASS_DEFINE(Field,NOP,NOP);
/*
A Field extractor to to obtain field values.
- */
+ */
static GPtrArray* wanted_fields = NULL;
+static dfilter_t* wslua_dfilter = NULL;
+
+/* We use a fake dfilter for Lua field extractors, so that
+ * epan_dissect_run() will populate the fields. This won't happen
+ * if the passed-in edt->tree is NULL, which it will be if the
+ * proto_tree isn't created by epan_dissect_init(). But that's by
+ * design - if shark doesn't pass in a proto_tree, it's probably for
+ * a good reason and we shouldn't override that. (right?)
+ */
+void wslua_prime_dfilter(epan_dissect_t *edt) {
+ if (wslua_dfilter && edt && edt->tree) {
+ dfilter_prime_proto_tree(wslua_dfilter, edt->tree);
+ }
+}
/*
* field extractor registartion is tricky, In order to allow
@@ -433,6 +447,9 @@ void lua_prime_all_fields(proto_tree* tree _U_) {
report_failure("while registering lua_fake_tap:\n%s",error->str);
g_string_free(error,TRUE);
}
+ else if (!dfilter_compile(fake_tap_filter->str, &wslua_dfilter)) {
+ report_failure("while compiling dfilter for wslua: '%s'", fake_tap_filter->str);
+ }
}
}