Ask Your Question

how to register a new LUA based dissector only to udp src port

asked 2018-02-27 14:09:55 +0000

BMWE gravatar image


I'd like to register my new dissector only to a udp src port

Therefore using following code

udp_table = DissectorTable.get("udp.port")

is not a good idea. I'd be glad to have an example how to do it to a specific udp source port (or destination port).

Thank you all

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-26 00:39:54 +0000

MarkoPaul0 gravatar image

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 ="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

    --Dissect your trivial protocol packet here
udp_table = DissectorTable.get("udp.port")

I hope this helps!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-02-27 14:09:55 +0000

Seen: 96 times

Last updated: Mar 26