[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #52403] lwIP TCP implementation violate RFC2525 sectio

From: Gao Qingshui
Subject: [lwip-devel] [bug #52403] lwIP TCP implementation violate RFC2525 section 2.17
Date: Tue, 14 Nov 2017 07:59:57 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36


                 Summary: lwIP TCP implementation violate RFC2525 section 2.17
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: kevingao
            Submitted on: Tue 14 Nov 2017 12:59:56 PM UTC
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: git head



Per RFC2525 section 2.17, one TCP RESET segment should be sent if there was
pending data not recved by user. But testing result show that lwIP send FIN
segment, not RESET segment.

The root case show below, pls refer the comments added by me:
static err_t
tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data)
  if (rst_on_unacked_data && ((pcb->state == ESTABLISHED) || (pcb->state ==
    /** Kevin Gao-- this judgement was not true when there was pending data
        not recved by applicantion. I focused on the 2nd judgement as the
        data was used in msgbox overflow case and not very common. when the
        close TCP socket, the buffered data would be freed and the
        would be restored to TCP_WND_MAX(pcb) before the judgement.
        Pls refer the code flow
        ->netconn_drain->tcp_recved] for detailed info.
        so pcb->rcv_wnd was alway equal to TCP_WND_MAX(pcb) if no new tcp
        posted by IP later.
    if ((pcb->refused_data != NULL) || (pcb->rcv_wnd != TCP_WND_MAX(pcb))) {
      /* Not all data received by application, send RST to tell the remote
         side about this. */
      LWIP_ASSERT("pcb->flags & TF_RXCLOSED", pcb->flags & TF_RXCLOSED);

      /* don't call tcp_abort here: we must not deallocate the pcb since
         that might not be expected when calling tcp_close */
      tcp_rst(pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip,
               pcb->local_port, pcb->remote_port);


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]