This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Lua script caused tshark to crash while sending tcp data

0

Tried to run a simple lua script in tshark, the socket connection worked fine but sending data caused the crash.

Here is the simple lua script (called te.lua),

local host, port = "127.0.0.1", 80
local socket = require("socket")
local tcp = assert(socket.tcp())

tcp:connect(host, port); –note the newline below io.write("sending…\n"); tcp:send("GET / HTTP/1.1\r\n\r\n"); io.write("finished sending…\n");

Here is the command line

tshark -Xlua_script:te.lua -r /0000.pcap tcp.port == 0

Using a debugger, here is the stack trace

#0  0x00007fffec4287fc in timeout_markstart ()
from /usr/local/lib/lua/5.2/socket/core.so
#1  0x00007fffec428b49 in buffer_meth_send ()
from /usr/local/lib/lua/5.2/socket/core.so
#2  0x00007ffff268c61d in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#3  0x00007ffff26979b4 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#4  0x00007ffff268c989 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#5  0x00007ffff268bfac in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#6  0x00007ffff268cbc1 in ?? () from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#7  0x00007ffff2688c9d in lua_pcallk ()
from /usr/lib/x86_64-linux-gnu/liblua5.2.so.0
#8  0x00007ffff5837293 in ?? ()
from /usr/lib/x86_64-linux-gnu/libwireshark.so.3
#9  0x00007ffff5837b80 in ?? ()
from /usr/lib/x86_64-linux-gnu/libwireshark.so.3
#10 0x00000000004097be in ?? ()
#11 0x00007ffff28d3f45 in __libc_start_main (main=0x409500, argc=7,
argv=0x7fffffffde98, init=<optimized out>, fini=<optimized out>,
rtld_fini=<optimized out>, stack_end=0x7fffffffde88) at libc-start.c:287
#12 0x000000000040c1d3 in _start ()

I am using tshark 1.10.6 on ubuntu 14.04 (64bit).

Any ideas?

Thanks

asked 12 Nov ‘16, 09:48

sharkfun's gravatar image

sharkfun
26559
accept rate: 0%


One Answer:

0

Interestingly another project reported an almost identical crash backtrace. It looks like the problem was a symbol conflict between that project's buffer_init routine and Lua's.

Wireshark in version 1.10 had a global symbol in libwsutil.so by that name. It was renamed (in time for 2.0.0) to ws_buffer_init.

So: you should upgrade to 2.0.0 or later to fix the problem.

answered 10 Jan '17, 05:59

JeffMorriss's gravatar image

JeffMorriss ♦
6.2k572
accept rate: 27%

Thanks for the idea, I tried 2.0.0 and don't see the crash. However, it doesn't seem to make the TCP connection though. Any ideas?

(10 Jan '17, 18:44) pktUser1001

Sorry, I've got no ideas about why the TCP connection wouldn't work in the newer version.

(11 Jan '17, 06:20) JeffMorriss ♦