buglwIP - A Lightweight TCP/IP stack - Bugs: bug #27955, netconn_close may nether return...

 
 

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

bug #27955: netconn_close may nether return when LWIP_TCPIP_CORE_LOCKING enabled

Submitter:  Dmirti Snejko <dsnejko>
Submitted:  Fri 06 Nov 2009 02:10:19 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.3.1

Sun 22 Nov 2009 04:09:45 PM UTC, comment #1: 

Totally right. Thanks for reporting this.

Fixed by directly calling sys_sem_signal instead of TCPIP_APIMSG_ACK.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 06 Nov 2009 02:10:19 AM UTC, original submission:  

When received RST from a remote side TCPIP core sets netconn->err to ERR_RST  and netconn->pcb.tcp to NULL.
Closing the connection with netconn_close(netconn) finally makes the core to call do_close callback:
void
do_close(struct api_msg_msg *msg)
{
#if LWIP_TCP
 if ((msg->conn->pcb.tcp != NULL) && (msg->conn->type == NETCONN_TCP)) {
     msg->conn->state = NETCONN_CLOSE;
     do_close_internal(msg->conn);
     /* for tcp netconns, do_close_internal ACKs the message */
 } else
#endif /* LWIP_TCP */
 {
   msg->conn->err = ERR_VAL;
   TCPIP_APIMSG_ACK(msg);         // <- the bug
 }
}

which in this case supposed to call macro TCPIP_APIMSG_ACK(msg) to release the application layer. With LWIP_TCPIP_CORE_LOCKING enabled macro TCPIP_APIMSG_ACK(msg) is defined empty. As result the application layer blocks on waiting  conn->op_completed semaphore, netconn_close nether returns.

Instead calling TCPIP_APIMSG_ACK(msg) it should be replaced with :
  if (msg->conn->op_completed != SYS_SEM_NULL) {
    sys_sem_signal(msg->conn->op_completed);

as do_delconn(struct api_msg_msg *msg) does.

Dmirti Snejko <dsnejko>

 

(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 dsnejko (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-11-22 goldsimon Open/ClosedOpen Closed
        StatusNone Fixed
        Assigned toNone goldsimon

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code