Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to call the original dissector in chained dissectors?

I'm working on a Lua Dissector for my own arp protocol.

do
    local arp_wrap_proto = Proto("arp_extra", "Extra ARP Protocol");


    local original_arp_dis 
    function arp_wrap_proto.dissector(buf, pinfo, tree)
        if 10 == buf(0, 1):uint() then
            pinfo.cols.protocol = "Extra ARP"
            -- do smt
        else
            -- Original ARP 
            original_arp_dis:call(buf, pinfo, tree)
        end
    end

    local arp_dis_table = DissectorTable.get("ethertype")
    original_arp_dis = arp_dis_table:get_dissector(2054)
    arp_dis_table:add(2054, arp_wrap_proto)
end

I want to use my own dissector for buf(0,1) == 10,

other conditions, try to call the original dissector for ARP.

But I got this ERROR: lua:12: attempt to index upvalue 'original_arp_dis' (a nil value)

How can I get it work?