[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #37958] netconn API doesn't handle correctly connectio
From: |
Valery Ushakov |
Subject: |
[lwip-devel] [bug #37958] netconn API doesn't handle correctly connections half-closed by peer |
Date: |
Wed, 19 Dec 2012 15:26:23 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.11) Gecko/20100101 Firefox/10.0.11 |
URL:
<http://savannah.nongnu.org/bugs/?37958>
Summary: netconn API doesn't handle correctly connections
half-closed by peer
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: uwe
Submitted on: Wed 19 Dec 2012 03:26:21 PM GMT
Category: None
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: CVS Head
_______________________________________________________
Details:
Half-open connections that were half-closed by peer are stuck with
netconn::last_err = ERR_CLSD, which prevents further writes over them. Cf.
netconn_recv_data:
if (buf == NULL) {
API_EVENT(conn, NETCONN_EVT_RCVMINUS, 0);
/* Avoid to lose any previous error code */
NETCONN_SET_SAFE_ERR(conn, ERR_CLSD);
return ERR_CLSD;
}
As a quick kludge I changed that to
sys_mbox_free(&conn->recvmbox);
sys_mbox_set_invalid(&conn->recvmbox);
which, from a quick look, should be thread-safe, since recv_tcp() won't send
anything after sending NULL pbuf to indicate that peer has performed close.
And changed LWIP_ERROR checks for sys_mbox_valid(&conn->recvmbox) in
netconn_recv() and netconn_recv_data() with explicit
if (!sys_mbox_valid(&conn->recvmbox)) {
return sys_mbox_valid(&conn->acceptmbox) ? ERR_CONN : ERR_CLSD;
}
which seems to work, but I haven't investigated/tested this thoroughly.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?37958>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #37958] netconn API doesn't handle correctly connections half-closed by peer,
Valery Ushakov <=