Mon 17 Oct 2011 06:48:13 AM UTC, original submission:
I'm using the GIT head of lwIP
While developing with lwIP api/sockets.c, I was to able to crash it.
If you open a SOCK_STREAM (tcp) socket, and having it established you shutdown(SHUT_WR) it
It is still possible to receive data on the TCP connection,
usually you receive the FIN+ACK from the other side.
However, when you shutdown(SHUT_WR) --> netconn_shutdown(conn, shut_rx=0, shut_tx=1) --> netconn_close_shutdown(conn, NETCONN_SHUT_WR) --> do_close(NETCONN_SHUT_WR) --> do_close_internal(NETCONN_SHUT_WR)
after do_close_internal successfully calls tcp_shutdown()
it always does conn->pcb.tcp = NULL;
and when our stack receives the FIN+ACK from the other side,
our netconn recv_tcp() is called, and asserts for:
LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb);
Please note I must use SHUT_WR to inform the other side for connection termination, and then wait for his RST/FIN response.
I hope to be able to provide an example of this crash in the upcoming week, as I'm developing a Python bindings for lwIP. My sockets code example is written completely in Python. Soon you will be able to unit-test lwIP API with Python.
Thanks,
Amir Shalem
|