Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Ethernet dissector

From: Antonello Tartamo <antonellotartamo@xxxxxxxxx>
Date: Sun, 23 May 2021 14:06:04 +0200
Hello everyone,
I'm trying to create an ethernet dissector for a custom protocol working on L2.
 
In proto_reg_handoff_myproto() function I've called:
heur_dissector_add("eth", dissect_myproto, "MyProtocol", "mp", proto_mp, HEURISTIC_ENABLE);
eth_handle = find_dissector("eth_withoutfcs");

then in the dissect_myproto function when I call:
tvbuff_t* next_tvb = tvb_new_subset_remaining(tvb, 0);
int new_off = call_dissector(eth_handle, tvb, pinfo, tree);
return new_off;

I get the following two errors on the terminal:
** (wireshark:11483): WARNING **: 07:31:59.826: Dissector bug, protocol Ethernet, in packet 12: /home/osboxes/Devel/wireshark/epan/packet.c:2794: failed assertion "saved_layers_len < 500"

** (wireshark:11483): WARNING **: 07:31:59.826: Dissector bug, protocol Ethernet, in packet 12: /home/osboxes/Devel/wireshark/epan/packet.c:775: failed assertion "saved_layers_len < 500"

I'm running the development wireshark with ./run/wireshark.

I think the error is due to the fact the both the heuristic dissector and the "find_dissector" are ethernet based.
Is there another way to reuse the ethernet dissector and avoid manually adding to the tree the src/dst mac addresses and the ethertype ?

Thanks in advance
Antonello