Ask Your Question

Revision history [back]

I don't believe it is possible to register your dissector for a source port as opposed to a destination port. You can only register your dissector for "a port". However, what you can do is register your UDP dissector for that port and then in your dissector return 0 if you detect that the src_port is actually not what you want. Let me give you an example:

local p_triv = Proto.new("triv", "Trivial Protocol")

function p_triv.dissector(buf, pinfo, tree)
    if pinfo.src_port ~= 77777 then
        return 0;  --lets wireshark know nothing was dissected, other dissectors can be called
    end

    --Dissect your trivial protocol packet here
end
udp_table = DissectorTable.get("udp.port")
udp_table:add(7777,trivial_proto)

I hope this helps!