I am writing a dissector in Lua for a custom binary protocol. I have defined three field types:
f.field1 = ProtoField.bytes("myproto.field1","Field 1",base.HEX)
f.field2 = ProtoField.uint16("myproto.field2","Field 2",base.HEX)
f.field3 = ProtoField.bytes("myproto.field3","Field 3",base.HEX)
These fields are added to the tree like this:
subtree:add(f.field1,buf(offset,4))
offset = offset + 4
val2 = buf(offset,2):uint()
– some logic around populating f2_description omitted
offset = offset + 2
subtree:add(f.field2, val2):append_text(" (" ..f2_description ..")")
subtree:add(f.field3, buf(offset,2))
Now, when I open Wireshark and click on “Field 1” or “Field 3” in the dissected packet’s tree, I see that the selected data is highlighted in the raw packet hex view (bottom most panel):

but it is not the case for Field2.

What am I doing wrong?
asked 13 Feb ‘12, 13:02

Konrads
21●1●1●4
accept rate: 0%
edited 13 Feb ‘12, 17:33

helloworld
3.1k●4●20●41
Thanks! it works!