How do I get and display packet data information at a specific byte from the first byte?
asked Oct 31 '17
updated Oct 31 '17
Hello, I am a beginner in Wireshark and dissector building, right now I'm just trying to figure out how to fetch and display packet data. I use the following lines in my dissect function:
guint val;
val = tvb_get_guint8(tvb, 1);
proto_tree_add_uint(masp_tree, hf_masp_data, tvb, 1, 1, val);
Here is an image of the results:

Expected result: 0x00
Actual result: 0x60
Why does fetching the data start from the 43rd byte instead of the very 1st one? How do I resolve this issue?
Thanks

Thanks for the answer, I was expecting the second byte (the one beside 01, in the top left corner). I'm aware that passing the 4th parameter as 1 in proto_tree_add_uint() would get me the byte at offset 1 in the tvb, it's just that I was expecting the tvb to start from 01 (the byte at the top left corner of byte view).
Any idea on how I can set this offset to 0?
The second byte you are referring to is part of the Ethernet payload, and is not part of the tvb corresponding to the UDP payload (the one that is being given to your dissector). The UDP payload starts at offset 0x2a, so the second byte is 0x60 as seen in your capture.
Why do you want to access the top tvb corresponding to the Ethernet frame?
It's for a project. Is there a way to access the top tvb corresponding to the Ethernet frame?
Do you need only the byte or will the Ethernet address do? If the latter, then the packet_info structure passed to your dissector has a member named
dl_dstthat holds the data link layer destination address.I need only the byte