Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Lua dissector: Field extractor to get the last matched userdata

I want to create a Lua Dissector for LLDP TLV.

Pseudocode:

local subtype_f = Field.new("lldp.ieee.802_1.subtype")

function myproto.dissector(buf, pinfo, treeitem)
    local subtype = subtype_f()
    if subtype.value == A_SUBTYPE then
        do_something
    end
end

In one packet, there are 3 TLVs containing "lldp.ieee.802_1.subtype" field,

but the code local subtype = subtype_f() only get the first one FieldInfo,

How can I get the last one or retrieve the return value of subtype_f()

Lua dissector: Field extractor to get the last matched userdata

I want to create a Lua Dissector for LLDP TLV.

Pseudocode:

local subtype_f = Field.new("lldp.ieee.802_1.subtype")

local myproto = Proto("myproto", "My Proto")

function myproto.dissector(buf, pinfo, treeitem)
    local subtype = subtype_f()
    if subtype.value == A_SUBTYPE then
        do_something
    end
end

register_postdissector(myproto)

In one packet, there are 3 TLVs containing "lldp.ieee.802_1.subtype" field,

but the code local subtype = subtype_f() only get the first one FieldInfo,

How can I get the last one or retrieve the return value of subtype_f()

Lua dissector: Field extractor to get the last matched userdata

I want to create a Lua Dissector for LLDP TLV.

Pseudocode:

local subtype_f = Field.new("lldp.ieee.802_1.subtype")

local myproto = Proto("myproto", "My Proto")

function myproto.dissector(buf, pinfo, treeitem)
    local subtype = subtype_f()
    if subtype.value == A_SUBTYPE then
        do_something
    end
end

register_postdissector(myproto)

In one packet, there are 3 TLVs containing "lldp.ieee.802_1.subtype" field,

but the code local subtype = subtype_f() only get the first one FieldInfo,

How can I get the last one or retrieve the return value of subtype_f()