[En-Nut-Discussion] Extra packet in ethernet packet
Coleman Brumley
cbrumley at polarsoft.biz
Fri Jun 12 18:00:06 CEST 2015
The code should be modified as follows:
sz += nb->nb_dl.sz;
//if (sz & 1) {
// sz++;
//}
Since the AT91 EMAC isn't limited to only sending odd or even bytes, there
is no need to check.
Coleman
> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Pawel
> Sent: Friday, June 12, 2015 3:42 AM
> To: Ethernut User Chat (English)
> Subject: Re: [En-Nut-Discussion] Extra packet in ethernet packet
>
> Hello
>
> > 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.
> Does anyone resolved this problem?
> Removing "sz++" is not enough to send packet with odd bytes number.
>
> best regards
> Pawel
>
>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
More information about the En-Nut-Discussion
mailing list