lwip-devel
[Top][All Lists]
Advanced

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

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


From: David Hammerton
Subject: [lwip-devel] Bug in tcp_connect - never timing out.
Date: Mon, 3 May 2010 11:53:30 +1000

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


reply via email to

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