Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You need to set the handle before the function. Try:

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

    local original_arp_dis = Dissector.get("arp")
    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")
    arp_dis_table:add(2054, arp_wrap_proto)
end

Or you can use your original method for obtaining the original_arp_dis handle, but you need to move the following 2 lines before the function:

local arp_dis_table = DissectorTable.get("ethertype")
local original_arp_dis = arp_dis_table:get_dissector(2054)