This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: RedBoot sending incorrect TCP window size
- To: ecos-discuss at sources dot redhat dot com
- Subject: Re: [ECOS] RedBoot sending incorrect TCP window size
- From: Donnat Eric <e dot donnat at ri dot silicomp dot fr>
- Date: Thu, 08 Feb 2001 21:15:29 +0100
- Organization: Silicomp RI
- References: <20010208105133.A1381@visi.com>
Grant Edwards 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...
>
> --
> Grant Edwards
> grante@visi.com
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)
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.
--
#include <stddef.h>
typedef unsigned char t[6];
typedef struct {
t x1;
t x2;
unsigned short s;
} st;
const int is = sizeof(s);
const st stt[2] = { { {1,2,3,4,5,6}, {1,2,3,4,5,6}, 1000 },
{ {1,2,3,4,5,6}, {1,2,3,4,5,6}, 2000 } };
--
Eric DONNAT
Silicomp Research Institute
2 avenue de Vignate, 38610 Gieres, France.
http://www.ri.silicomp.com