[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Bug in TCP ooseq FIN processing
From: |
Kieran Mansley |
Subject: |
Re: [lwip-devel] Bug in TCP ooseq FIN processing |
Date: |
Sat, 13 Dec 2003 15:40:53 +0000 (GMT) |
On Sat, 13 Dec 2003, Karl Jeacle wrote:
> There is a small bug in lwIP's TCP handling of out-of-sequence FIN segments.
>
> For me, this problem exhibits itself with my receiving application blocking
> forever on netconn_recv() despite the sender having closed the connection.
>
> The problem is caused when tcp_receive() checks to see if out-of-sequence
> segments are now in sequence. It checks if an ooseq segment was a FIN,
> but it does this incorrectly. Instead of looking at the flags on the
> ooseq segment itself, it uses the "flags" variable. But "flags" is set
> for the value of the current segment being processed by TCP, not the
> ooseq segment. The fix in tcp_in.c is simple:
>
> 1024c1024
> < if (flags & TCP_FIN) {
> ---
> > if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) {
Well spotted, and thanks for the fix. Interestingly the relevant line in
my 0.5.2 based tree is:
if(TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) {
inseg refers to the most recent segment received, so the bug exists there
too - the source has been changed, but the bug not spotted.
I'll check in a fix as soon as savannah is fully operational.
Kieran