Ask Your Question
0

Lua dissector clean up of data tables

asked 2018-06-01 04:22:56 +0000

cmcqueen1975 gravatar image

updated 2018-06-18 01:59:11 +0000

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-20 07:18:42 +0000

cmcqueen1975 gravatar image

updated 2018-06-20 07:19:21 +0000

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-06-01 04:22:56 +0000

Seen: 61 times

Last updated: Jun 20