This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

calling a dissector fails with tvb subset in lua

1
1

Hi,

I have an disssector that calls another post-dissector.

That works fine in Wireshark 2.2.0 with

function my_proto.dissector(tvb,pinfo,tree)
    local ptp_dissector_table = DissectorTable.get("ptp.data")
    local packet_dissector = ptp_dissector_table:get_dissector('ptp') 
    packet_dissector(tvb, pinfo, tree) 
 end

but fails as soon as I use

  packet_dissector(tvb(some_offset), pinfo, tree)

with 'Bad argument #2 to packet_dissector (Tvb expected, got userdata)

Any hints?

asked 21 Oct '16, 04:52

Thomas%20E's gravatar image

Thomas E
36459
accept rate: 0%


One Answer:

2

Use

packet_dissector(tvb:range(some_offset,some_length):tvb(), pinfo, tree)

(fixed according to the comment of @Thomas E).

answered 21 Oct '16, 05:07

sindy's gravatar image

sindy
6.0k4851
accept rate: 24%

edited 21 Oct '16, 10:46

Actually it is

packet_dissector(tvb:range(some_offset,some_length):tvb(), pinfo, tree)

Thanks, Thomas

(21 Oct '16, 07:54) Thomas E