I'm sending a raw Ethernet frame to the loopback interface (Linux ubuntu 4.15.0-34-generic) with the following python code:
from scapy.all import *
pkt = Ether(dst="aa:aa:aa:aa:aa:aa", src="00:ff:00:ff:00:ff", type=0x6666) / ("A"*50)
sendp(pkt, iface="lo")
(We use a custom Ethernet type 0x6666, but using the packet length (50) as specified by the Ethernet II frame format has the same outcome)
I would expect to see a packet of length 14+50=64 bytes on the receiver (or in Wireshark). Instead, I'm seeing a packet of 14+50+14=78 bytes. The content of the added 14 bytes are seemingly random (or likely data from a reused buffer which was not zeroed).
As an example, the following Wireshark outputs are from two consecutive invocations of the code above:
0000 aa aa aa aa aa aa 00 ff 00 ff 00 ff 66 66 41 41 ............ffAA
0010 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0020 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0030 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0040 00 00 00 00 00 00 10 00 00 00 00 00 00 00 ..............
0000 aa aa aa aa aa aa 00 ff 00 ff 00 ff 66 66 41 41 ............ffAA
0010 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0020 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0030 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0040 22 20 68 6f 73 74 6e 61 6d 65 3d 3f 20 61 " hostname=? a
I'm curious why the 14 bytes are added (since the packet is longer than the required 64 bytes for an Ethernet packet it's not a padding issue)? And how it's possible to get rid of the 14 extra bytes in this example?