lwip-devel
[Top][All Lists]
Advanced

[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

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

                 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

    _______________________________________________________

Details:

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 ==
CLOSE_WAIT))) {
    /** Kevin Gao-- this judgement was not true when there was pending data
        not recved by applicantion. I focused on the 2nd judgement as the
refused
        data was used in msgbox overflow case and not very common. when the
user
        close TCP socket, the buffered data would be freed and the
pcb->rcv_wnd
        would be restored to TCP_WND_MAX(pcb) before the judgement.
        Pls refer the code flow
[lwip_close->netconn_delete->lwip_netconn_do_delconn
        ->netconn_drain->tcp_recved] for detailed info.
        so pcb->rcv_wnd was alway equal to TCP_WND_MAX(pcb) if no new tcp
data
        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:

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

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




reply via email to

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