First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

Lua dissector clean up of data tables

I've written a protocol dissector in Lua, and it is working reasonably well.

It stores some end-point information (e.g. end-point device type) in a Lua table, to provide more informative description of packets during dissection.

That is fine, except that if I close a pcap file, and open a different one, with different end-point addresses, then I find that the Lua table is still populated with information from dissecting the first pcap file. That leads to confusing information in the packet dissection.

How is it possible to have a different data table per pcap file opened? Or maybe to clear the table when the first pcap file is closed?

I read about "registering a cleanup routine". But I can't find any information about how to do that in Lua, so I'm guessing that is for a dissector written in C.

cmcqueen1975's avatar
5
cmcqueen1975
asked 2018-06-01 04:22:56 +0000, updated 2018-06-18 01:59:11 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Proto objects can be given an init() function. It's not totally clear to me when this function is called, but comments in the Wireshark source code suggest it might be every time a file is opened.

I'm not sure how to store a different data table per pcap file opened.

cmcqueen1975's avatar
5
cmcqueen1975
answered 2018-06-20 07:18:42 +0000, updated 2018-06-20 07:19:21 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer