get_filter Lua function doesn't return the filter
Summary
In Wireshark's Lua API, get_filter
returns an empty string instead of the current filter. I asked about this on the Wireshark Q&A forum here.
Steps to reproduce
In Wireshark, go to Tools > Lua > Evaluate, paste the following script, and evaluate it:
local function get_display_filter()
if get_filter then
local e = get_filter()
return "Current filter: '" .. e .. "' (length " .. string.len(e) .. ")"
end
end
local function test()
set_filter("ip.addr == 0.0.0.0")
apply_filter()
local splash = TextWindow.new("Test get_filter");
splash:append(get_display_filter())
end
-- Should say "Current filter: 'ip.addr == 0.0.0.0' (length 18)"
test()
This will set the display filter, apply the change, and then display the results of get_filter
in a popup. I see "Current filter: '' (length 0)" instead of "Current filter: 'ip.addr == 0.0.0.0' (length 18)".
What is the current bug behavior?
An empty string is returned from get_filter
.
What is the expected correct behavior?
get_filter
should return the current filter as a string.
Sample capture file
N/A
Relevant logs and/or screenshots
N/A
Build information
3.2.7 (Git v3.2.7 packaged as 3.2.7-1~ubuntu20.04.0+wiresharkdevstable1)
Compiled (64-bit) with Qt 5.12.8, with libpcap, with POSIX capabilities (Linux),
with libnl 3, with GLib 2.64.3, with zlib 1.2.11, with SMI 0.4.8, with c-ares
1.15.0, with Lua 5.2.4, with GnuTLS 3.6.13 and PKCS #11 support, with Gcrypt
1.8.5, with MIT Kerberos, with MaxMind DB resolver, with nghttp2 1.40.0, with
brotli, with LZ4, with Zstandard, with Snappy, with libxml2 2.9.10, with
QtMultimedia, without automatic updates, with SpeexDSP (using system library),
with SBC, with SpanDSP, without bcg729.
Running on Linux 4.4.0-18362-Microsoft, with Intel(R) Core(TM) i7-8565U CPU @
1.80GHz (with SSE4.2), with 16129 MB of physical memory, with locale C.UTF-8,
with light display mode, without HiDPI, with libpcap version 1.9.1 (with
TPACKET_V3), with GnuTLS 3.6.13, with Gcrypt 1.8.5, with brotli 1.0.7, with zlib
1.2.11, binary plugins supported (18 loaded).
Built using gcc 9.3.0.