[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] pcb->lbb = ISS - 1?
From: |
Kieran Mansley |
Subject: |
Re: [lwip-devel] pcb->lbb = ISS - 1? |
Date: |
Tue, 10 Apr 2012 09:59:30 +0100 |
On Tue, 2012-04-10 at 12:49 +0800, narke wrote:
> I found the first segment (SYN) sent from a connection has a seqno of
> tcp_next_iss() - 1, and this is because the segment was created with a
> seqno equals with pcb-lbb, which was assigned with tcp_next_iss() in
> the tcp_connect() function. Why is this '- 1' operation is
> necessary?
The code in question is I think this, from tcp_connect():
iss = tcp_next_iss();
pcb->snd_nxt = iss;
pcb->lastack = iss - 1;
pcb->snd_lbb = iss - 1;
I'm not sure why it has been written that way. It does strike me as
odd. snd_lbb is the sequence number of next byte to be buffered, so it
would make sense for it to be equal to snd_nxt rather than lastack.
In tcp_alloc() we do this instead:
iss = tcp_next_iss();
pcb->snd_wl2 = iss;
pcb->snd_nxt = iss;
pcb->lastack = iss;
pcb->snd_lbb = iss;
Kieran