This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ecos: tcp/ip stack implementation error
- From: Martin Buck <martin dot buck at ascom dot ch>
- To: ecos-discuss at sources dot redhat dot com
- Date: Wed, 19 Feb 2003 18:01:42 +0100
- Subject: Re: [ECOS] ecos: tcp/ip stack implementation error
- Organization: Ascom Systec Applicable Research and Technology
- References: <F7qNgsPHjxSfHkdrG500002e306@hotmail.com>
? ? wrote:
> Hi,
> i am willing to show a implementation error in ecos tcp/ip stack:
> as for tcp urgent pointer,when urp >65496(not 65535),urp should be
> 65535.because 65536-20(iphdr)-20(tcphdr)=65496.
> following is ecos code:
> u_int32_t urp = tp->snd_up - tp->snd_nxt;
> if (urp > IP_MAXPACKET)//65535
> urp = IP_MAXPACKET;
>
> it should like this:
> if(urp > IP_MAXPACKET-sizeof(struct tcpip))
> urp = IP_MAXPACKET;
Most likely it shouldn't. The urgent pointer is a 16 bit field and the
check for IP_MAXPACKET just seems to be there to limit the value of the
urgent pointer to values representable with 16 bits. The reasoning is
probably that it's better to send a saturated value than a completely
bogus value (which you'd get if you just sent the lower 16 bits of a 32
bit value).
BTW, the FreeBSD code doesn't contain the check for IP_MAXPACKET at all,
so it's guaranteed to send bogus urgent pointers if you have a
sufficiently large and filled send buffer. But then, nobody cares about
urgent pointers anyway these days...
BTW#2, even if would make sense to take the size of the IP+TCP headers
into account here, your fix would be wrong beause it assumes that their
size is constant.
Martin
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss