lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #57525] [TCP][RST] request to call tcp send callback i


From: chenwu
Subject: [lwip-devel] [bug #57525] [TCP][RST] request to call tcp send callback if pcb->acked >= 0 when tcp client received last tcp rst segment
Date: Fri, 3 Jan 2020 03:10:52 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36

URL:
  <https://savannah.nongnu.org/bugs/?57525>

                 Summary: [TCP][RST] request to call tcp send callback if
pcb->acked >= 0 when tcp client received last tcp rst segment
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: chenwu
            Submitted on: Fri 03 Jan 2020 08:10:50 AM UTC
                Category: TCP
                Severity: 3 - Normal
              Item Group: Feature Request
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 1.4.1

    _______________________________________________________

Details:

Dear lwip maintainers:
  Please consider a situation like the following:

lwip version: all v1.4.1+
the tcp packets in the attachment.

1. WiFi device runs lwip as the tcp client, and connected to remote tcp
server.
2. tcp client send n-bytes data to tcp server, server echos the same n-bytes
data to tcp client.
3. data transmit OK for several times
4. tcp client send n-bytes data to tcp server, server reply a TCP RST segment,
in RST segment, including n-bytes data and valid sequence and ack.
5. We expect tcp client will call tcp send callback, and then, abort the
connection and goes to the CLOSED state.
// actually in lwip, tcp client does not call tcp send callback,
// it leads to tcp client mis-understand that last n-bytes does not send OK.


A workaround in our side, with lwip v1.4.1:
http://git.savannah.nongnu.org/cgit/lwip.git/tree/src/core/tcp_in.c?h=DEVEL-1_4_1,
Line 308- LIne 316


      if (recv_flags & TF_RESET) {
        TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_RST);
        tcp_pcb_remove(&tcp_active_pcbs, pcb);
        memp_free(MEMP_TCP_PCB, pcb);
      } 

Could we modify it to the following:

      if (recv_flags & TF_RESET) {
        if (pcb->acked > 0) {
          TCP_EVENT_SENT(pcb, pcb->acked, err);
          if (err == ERR_ABRT) {
            goto aborted;
          }
        }
        TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_RST);
        tcp_pcb_remove(&tcp_active_pcbs, pcb);
        memp_free(MEMP_TCP_PCB, pcb);
      } 


I am not sure the modification whether it will affect other lwip functions,
but at least, it looks like solve the tcp send callback problem.


Look forward to your reply.

Thanks.
Best regards,
Chen Wu 陈武 | address@hidden
Software Engineer| Espressif Systems

www.espressif.com
Floor 4, Block 6, 899 Zhenze Road,
Tech Park, Wuxi, China



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 03 Jan 2020 08:10:50 AM UTC  Name: tcp-rst.pkt  Size: 70KiB   By:
chenwu

<http://savannah.nongnu.org/bugs/download.php?file_id=48160>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?57525>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

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