ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] Custom item not related to the packet

From: Antonello Tartamo <antonellotartamo@xxxxxxxxx>
Date: Wed, 26 May 2021 08:46:08 +0200
Hello everyone,
I'm trying to add a custom item which is not strictly related to the packet but it is coming from a processing of a part of the packet.
I've used the following instructions:

                new_tvb = tvb_new_child_real_data(tvb, pt, (guint)16, 16);
                add_new_data_source(pinfo, new_tvb, "processed");

                ti = proto_tree_add_item(data_tree, hf_mp_control_processed, new_tvb, 0, 16, ENC_NA);
                PROTO_ITEM_SET_GENERATED(ti);

hf_mp_control_processed is a set of bytes: 
        { & hf_mp_control_processed ,
          { "mp control processed", "mp.control.processed",
            FT_BYTES, BASE_NONE, 0x0, 0x0,
            NULL, HFILL }
        }

The problem is that when I click on this new item into the Packet Details I see the correct byte values, while in the Packet Bytes view these ones are totally wrong.

Attached image:
image.png
For example the first byte is 0x48 but 0x68 is shown in the Packet Bytes view.

Is there a different way to perform this operation ?

Thanks in advance