[bug #27955] netconn_close may nether return when LWIP_TCPIP_CORE_LOCKING enabled

View: New views
2 Messages — Rating Filter:   Alert me  

[bug #27955] netconn_close may nether return when LWIP_TCPIP_CORE_LOCKING enabled

by Evgenii Philippov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.nongnu.org/bugs/?27955>

                 Summary: netconn_close may nether return when
LWIP_TCPIP_CORE_LOCKING enabled
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: dsnejko
            Submitted on: Fri 06 Nov 2009 02:10:19 AM 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: 1.3.1

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?27955>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/



_______________________________________________
lwip-devel mailing list
lwip-devel@...
http://lists.nongnu.org/mailman/listinfo/lwip-devel

[bug #27955] netconn_close may nether return when LWIP_TCPIP_CORE_LOCKING enabled

by Evgenii Philippov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Update of bug #27955 (project lwip):

                  Status:                    None => Fixed                  
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #1:

Totally right. Thanks for reporting this.

Fixed by directly calling sys_sem_signal instead of TCPIP_APIMSG_ACK.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?27955>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/



_______________________________________________
lwip-devel mailing list
lwip-devel@...
http://lists.nongnu.org/mailman/listinfo/lwip-devel