[En-Nut-Discussion] Extra packet in ethernet packet
Harald Kipp
harald.kipp at egnite.de
Mon Dec 8 20:05:18 CET 2014
Hi,
On 05.12.2014 20:51, Philipp Burch wrote:
> On 05.12.2014 20:42, Mingshu Wang wrote:
>> I found an issue in one of our products that is using Nut/OS 4.8.7 and AT91SAM7X256. If I send a packet with odd number of characters to my computer, an extra byte is padded at the end. Wireshark interprets it as "VSS-Monitoring Ethernet trailer". If the packet size is an even number, everything is fine. Most applications can handle this packet correctly. But some applications don't read the length in the header. They just process all characters in the packet and think this is a wrong message.
>
> In the EmacPutPacket() function in nut/arch/arm/dev/atmel/at91_emac.c,
> there is this code:
>
> sz += nb->nb_dl.sz;
> if (sz & 1) {
> sz++;
> }
Applications must always honor the lengths provided in the headers. The
minimum size of an Ethernet payload is 46 octets
http://wiki.wireshark.org/Ethernet
http://tools.ietf.org/html/rfc894
So, padding may always occur. Most Ethernet controllers add padding
bytes automatically.
Some Ethernet controllers cannot transmit odd number of bytes. As far as
I can see, the AT91 EMAC doesn't have this limitation. I guess, that the
code snippet above had been inherited from another driver.
Regards,
Harald
More information about the En-Nut-Discussion
mailing list