lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Antw: RE: [lwip-users] pbuf_header fails in etharp_output


From: Kieran Mansley
Subject: Re: Antw: RE: [lwip-users] pbuf_header fails in etharp_output
Date: Tue, 22 May 2007 14:04:28 +0100

On Tue, 2007-05-22 at 14:43 +0200, Matthias Weisser wrote:
> 
> >>> "Goldschmidt Simon" <address@hidden> 
> >> lwIP is a little bit cheeky and reuses the pbuf with the ICMP 
> >> request to form the ICMP reply.  It is therefore assuming 
> >> that there is room at the front for the necessary headers.  I 
> >> suppose if your ethernet driver was being very efficient and 
> >> had stripped off the ethernet header before creating the 
> >> pbuf, this might not be the case.  Can you show how you're 
> 
> Yes, that's what I am doing.

In that case it's technically the fault of lwIP and we should perhaps
change our ICMP to not do this (or at least check the pbuf to see if
it's OK before it does).  If you'd rather not work around it, please
file a bug so that it will eventually get fixed.

>  If a ethernet frame with type IP arrives I strip the 14 byte ethernet
> header. But not because I want to save memory (RAM is not the big
> problem in my system) but because I need the IP header aligned at a 4
> byte boundary.

The normal way to achieve the IP header aligned on a 4-byte boundary is
to get your MAC to deliver the packet to a 2-byte offset.  Then, if you
have a 14-byte ethernet header, the IP header should be aligned as you
require.  Not all MACs support this though I suppose, so your way should
also be supported.

An easy workaround would be in this case to call pbuf_header to reserve
16 bytes before you copy in the packet data.  This would ensure there is
space in the pbuf to put the outgoing ethernet header, but is really a
bit of a hack and the right thing to do is fix it in lwIP's ICMP code.

Kieran 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]