buglwIP - A Lightweight TCP/IP stack - Bugs: bug #34569, shutdown(SHUT_WR) crashes netconn...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #34569: shutdown(SHUT_WR) crashes netconn api

Submitter:  Amir Shalem <amirshalem>
Submitted:  Mon 17 Oct 2011 06:48:13 AM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Crash Error Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  CVS Head

Mon 17 Oct 2011 05:47:16 PM UTC, comment #1: 

Fixed, thanks for reporting!

Simon Goldschmidt <goldsimon>
Group administrator
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

Amir Shalem <amirshalem>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by amirshalem (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-10-17 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
        Planned Release 1.4.1

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code