buglwIP - A Lightweight TCP/IP stack - Bugs: bug #57525, [TCP][RST] request to call tcp...

 
 

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

bug #57525: [TCP][RST] request to call tcp send callback if pcb->acked >= 0 when tcp client received last tcp rst segment

Submitter:  chenwu <chenwu>
Submitted:  Fri 03 Jan 2020 08:10:50 AM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Feature Request Status:  Invalid
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.1

Fri 03 Jan 2020 08:24:11 AM UTC, comment #3: 


comment #2:

> A RST segment never ACKs new data, nor does it contain data (as you suggested in 4).
>
> The recv_acked variable (I assume you mean this one, since pcb->acked does not exist) is not even updated for a RST.
>
> Closing as invalid.


thanks for your information.

chenwu <chenwu>
Fri 03 Jan 2020 08:18:45 AM UTC, comment #2: 

A RST segment never ACKs new data, nor does it contain data (as you suggested in 4).

The recv_acked variable (I assume you mean this one, since pcb->acked does not exist) is not even updated for a RST.

Closing as invalid.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 03 Jan 2020 08:17:21 AM UTC, comment #1: 

In RFC 793, Part 3.4 tail, here is a Reset Processing description.
Please take a look if there is a function conflict.
Thanks.

chenwu <chenwu>
Fri 03 Jan 2020 08:10:50 AM UTC, original submission:  

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 陈武 | -email is unavailable-
Software Engineer| Espressif Systems

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

chenwu <chenwu>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #48160:  tcp-rst.pkt added by chenwu (70KiB - application/x-etherpeek)

 

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 chenwu (Submitted the item)
  • -email is unavailable- added by chenwu
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-03 goldsimon StatusNone Invalid
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2020-01-03 chenwu Attached File- Added tcp-rst.pkt, #48160
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code