Ask Your Question

Revision history [back]

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, and I wonder if that is for a dissector written in C.

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, and I wonder if so I'm guessing that is for a dissector written in C.