Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the pinfo.private table to send values from one Lua dissector to another. The values are available using pinfo.private.<key>. It's possible to use this datatypes: nil, boolean, number and string, but every value is converted to string so numbers must be converted back using tonumber() on use. Boolean is either nil or an empty string.

From your example set pktinfo.private.the_value like this:

second_dissector = Dissector.get("second_dissector")
range = tvbuf:range(hdr_size)
newtvb = range:tvb()
pktinfo.private.the_value = 42
num_bytes = second_dissector:call(newtvb, pktinfo, root)

Then in second_dissector fetch it with something like this:

local second_dissector(buffer, pinfo, tree)
    if tonumber(pinfo.private.the_value) == 42 then
        -- do something specific for this value