buglwIP - A Lightweight TCP/IP stack - Bugs: bug #45161, tcp.c / tcp_abandon /...

 
 

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

bug #45161: tcp.c / tcp_abandon / pcb->local_port set to zero but needed later for tcp_rst

Submitter:  Dipl. Ing. Bernhard Weber <weberbe1>
Submitted:  Thu 21 May 2015 12:06:56 PM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Thu 21 May 2015 01:45:42 PM UTC, comment #4: 

Fixed, thanks for reporting.

Simon Goldschmidt <goldsimon>
Group administrator
Thu 21 May 2015 01:44:16 PM UTC, comment #3: 

Ah, I see. This has been introduced last September when fixing bug #42299 :-(

Simon Goldschmidt <goldsimon>
Group administrator
Thu 21 May 2015 12:36:18 PM UTC, comment #2: 

the call stack is:
my software -> tcp_abort -> tcp_abandon -> tcp_rst

snipnet from tcp.c / void tcp_abandon(struct tcp_pcb *pcb, int reset)

if (send_rst) {
   LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n"));
   tcp_rst(seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port);
 }

The reason for calling this sequence ist another big problem, but i cannot track it down to generate a good description.
It feels like: send big data chunks to a win7 x64 pc, 64k window and no data is commited for at least 700ms -> calling tcp_abort (see above), wait for reconnect from pc (7-10 ms later with valid local port number, duration without valid local port: 200-1000ms) and resend all data to pc.

Dipl. Ing. Bernhard Weber <weberbe1>
Thu 21 May 2015 12:22:09 PM UTC, comment #1: 

Can you please describe the call stacks? What leads to calling tcp_abandon() and from where is tcp_rst() called?

Simon Goldschmidt <goldsimon>
Group administrator
Thu 21 May 2015 12:06:56 PM UTC, original submission:  

In routine tcp_abandon in tcp.c pcb block will be freed with TCP_PCB_REMOVE_ACTIVE. In this routine local_port will be set to zero.
But when it is necessary to call tcp_rst later on, local port will be zero.

Therfore local_port must be stored locally before calling TCP_PCB_REMOVE_ACTIVE or TCP_RMV and for tcp_rst the local copy of local_port must be used.

Now, without this bug correction, a RST will be sent to the other computer and will be ignored. Later, an incomming ACK of a data segment cannot be commited because of the missing pcb and now, a RST with the correct port info is sent to the other computer.

RST message from 192.168.0.101 port(0) to 192.168.0.51 port 64123
0000  00 25 90 7f 98 b8 00 0a  35 00 40 00 08 00 45 00  
0010  00 28 39 4b 00 00 ff 06  00 9c c0 a8 00 65 c0 a8  
0020  00 33 00 00 fa 7b 06 e2  67 12 68 ac c5 ad 50 14  
0030  ff ff 97 1d 00 00 00 00  00 00 00 00

Dipl. Ing. Bernhard Weber <weberbe1>

 

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

No files currently attached

 

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 weberbe1 (Submitted the item)
  •  

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

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-21 goldsimon StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-05-21 goldsimon Assigned toNone goldsimon
    2015-05-21 goldsimon StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code