This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RedBoot sending incorrect TCP window size


On Thu, Feb 08, 2001 at 09:15:29PM +0100, Donnat Eric wrote:

> > All occurrences of "sizeof (eth_header_t)" in net.h, tcp.c, udp.c
> > need to be replace by a hard coded constant.  I'll send a patch
> > later today...
> 
> You can always avoid the hard coded constant by computing the
> "real" limit of the struct as the offset to the last field +
> the size of this last field. This should always work if the
> last field is not a struct/bitfield ! (See stddef.h)

For some things that might be a better solution.  On a more
pragmatic note, the size of an Ethernet header is etched in
billions of pieces of silicon spread all over the world.  It's
14. Always. Everywhere. It's not going to change.

> To finnish with the "sizeof" story, you will see with following
> sample that the reported value of sizeof is compatible with the
> data representation and obviously with pointer arithmetic. Look
> at gernerated asm.

I agree that the sizeof value is consistent with the code
generated by the compiler.  It's just not consistent with the
size of an Ethernet header.  :)

-- 
Grant Edwards
grante@visi.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]