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

Declaring fields of chained dissectors in lua

0

Hi,

I started to make a lua port of the PTP/IP dissector split into the PTP/IP part and an dependent an PTP part. The idea is the PTP/IP dissector parses the IP specific structure parts (length, packet type) and then passes these to an PTP packet dissector.

However, in the PTP dissector I can not declare the 'imported' fields of the PTP/IP dissector:

top level

local length_field = Field.new("ptp.length")
local packet_type_field = Field.new("ptp.pktType")   
local header_offset_field = Field.new("ptp.headerOffset") -- protocol specific offset from the PTP/IP or PTP dissector

results in an error message bad argument #1 to 'new' (Field new: a field with this name must exist).

When I move it to function ptp_proto.dissector(tvb,pinfo,tree) the error message is (Field new: A Field extractor must be defined before Taps or Dissectors are called)

asked 08 Mar '16, 04:43

Thomas%20E's gravatar image

Thomas E
36459
accept rate: 0%


One Answer:

0

Maybe this is due to the order which Wireshark finds & executes your .lua files. Try creating a new script that initializes your dissectors in correct order.

Renaming your files in alphabetical order could also work .. if sorting order of read .lua files is the issue.

answered 27 Apr '16, 14:56

kim's gravatar image

kim
313
accept rate: 50%

It worked. The 'parent' dissector needs to load before the child dissectors. An implementation is at https://github.com/tengelmeier/mtp-tools/

(30 May '16, 07:49) Thomas E