[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Bug in tcp_connect - never timing out.

From: Simon Goldschmidt
Subject: Re: [lwip-devel] Bug in tcp_connect - never timing out.
Date: Mon, 03 May 2010 07:46:32 +0200

Could you please file a bug report on this so it doesn't get forgotten?

As to the suspected race condition: lwIP is in effect single-threaded, so the 
netif cannot go down between tcp_connect() and tcp_output_segment() (which is 
called from tcp_connect(), so no thread-change that sets the interface down can 
come in between). As such, I think testing for the route in tcp_connect() is 
fine. Another possibility would be to let tcp_connect() return the return value 
of tcp_output(), but we have to discuss this in the bug tracker.


David Hammerton wrote:
> Hi there,
> I've come across what I believe to be a bug in tcp_connect in lwip 1.3.2,
> and I'm not sure the best way to approach fixing it.
> If you call tcp_connect (which I'm doing via the socket APIs connect()
> function), and you have no valid netif interfaces that are up (ie, default
> interface is down), then tcp_output_segment will early-exit because
> ip_route
> fails to return an interface. This will mean that the callback given to
> tcp_connect will never be called.
> It seems the connection timeout stuff is dealt with in tcp_slowtmr(), but
> it
> will only ever timeout if pcb->rtime >= pcb->rto, which is never true as
> pcb->rtime is equal to -1, as a side effect of tcp_output_segment early
> exiting.
> Anyone got any thoughts on a possible solution?
> I thought about have tcp_connect test for a valid route before enqueuing
> the
> connection packet, but that will introduce a race condition (what if the
> interface goes down after tcp_connect is called?). Moreover, I wonder if
> this is a problem with other packets - will some packets just go stale and
> essentially leak if they go through tcp_output_segment when there is no
> interface?
> Thanks
> David
> -- 
> David Hammerton

GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

reply via email to

[Prev in Thread] Current Thread [Next in Thread]