Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Sep 2002 11:14:46 -0700
From:      "Justin C. Walker" <justin@mac.com>
To:        net@FreeBSD.ORG
Subject:   Re: computing the Ack Seq. No.
Message-ID:  <5A3F3774-C5B2-11D6-A7E3-00306544D642@mac.com>
In-Reply-To: <200209111750.g8BHoBZf032104@vashon.polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wednesday, September 11, 2002, at 10:50 AM, John Polstra wrote:

> In article <F6467yRLVbNDN4CxpAO000022f6@hotmail.com>,
> soheil h <soheil_h_y@hotmail.com> wrote:
>> hi list
>> I wrote the code below and it doesn't work correctly
>> please tell me what is wrong
>> int len, tlen;
>> tcpiphdr ti, ti_send;
>> int hlen;
>> int acklen;
>> /*
>> the hlen is ip header hlen
>> */
>> ....
>> /* the ip->ip_len is ntohs'ed by NTOHS in io_input() */
>> len = ti->ti_len;
>> tlen = ti->ti_off << 2;
>> acklen = len - hlen - tlen;
>> ti_send->ti_ack = htonl(ntohl(ti->ti_seq) + acklen );
>> /* this field is incorrect  and i don't know why */
>
> If the TH_SYN flag is set in the received packet, you must increment
> the ack by 1.  Likewise, if the TH_FIN flag is set, you must increment
> the ack by 1.  In other words, each of those flags counts the same as
> a byte of data, as far as the ack calculation is concerned.

Also, it's not clear to me why you include the IP header length in the 
count of acknowledged TCP bytes.  Perhaps I missunderstand your code...

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large  *
Institute for General Semantics        |   When LuteFisk is outlawed
                                        |   Only outlaws will have
                                        |       LuteFisk
*--------------------------------------*-------------------------------*


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A3F3774-C5B2-11D6-A7E3-00306544D642>