buglwIP - A Lightweight TCP/IP stack - Bugs: bug #20075, A problem with keep-alive timer...

 
 

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

bug #20075: A problem with keep-alive timer and TCP flags

Submitted by:  Srinivas Gollakota <gollakota>
Submitted on:  Mon 04 Jun 2007 08:49:13 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Frédéric Bernon <fbernon>
Open/Closed: ClosedPlanned Release: None
lwIP version: None

(Jump to the original submission Jump to the original submission)

Fri 04 Apr 2008 05:12:40 PM UTC, comment #7:

I have tested lwip keep-alive again.
Shrinivas suggested to send ACK and it was right.

At least Windows XP does not send [TCP Keep-Alive ACK] in reply to [TCP Keep-Alive] packets if [TCP Keep-Alive] packet does not have ACK flag.
And without reply after 9 try connection is broken.

If we see once more
4.2.3.6 TCP Keep-Alives http://www.freesoft.org/CIE/RFC/1122/114.htm
"It is extremely important to remember that ACK segments that contain no data are not reliably transmitted by TCP."
It means indirect, that Keep-Alive packets should have ACK flag.

Oleg Tyshev <olegreen>
Mon 11 Jun 2007 01:54:39 PM UTC, comment #6:

>I checked with the TCP flags set to 0 with my test and my test works same as to that of ACK flag set.So no objections with the fix.
>If you have the exact section in the RFC1122 that talks about the TCP flags in conjunction with keep alive timer please post it. I could only find about the sequence numbers nothing about flags.


Sorry, except link give in comment #3 (from RFC1122), the only source I have check is linux-2.6.21.4 source code, but even with that, it wasn't very clear. So, I have experiment to see the behavior (last thing to do when documentation isn't available)...

Ok, I check in and close that.

Thank to report that...

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Mon 11 Jun 2007 01:45:52 PM UTC, comment #5:

Patch file for Srinivas & Oleg if they want to test it...

(file #13013)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Mon 11 Jun 2007 01:35:55 PM UTC, comment #4:

I have set in tcp_keepalive a TCPH_FLAGS_SET(tcphdr, 0);

I have test with a pseudo telnet server with lwip with these parameters:

int flag=1;
setsockopt( sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, sizeof(flag));
flag=10;
setsockopt( sock, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&flag, sizeof(flag));
flag=2;
setsockopt( sock, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&flag, sizeof(flag));
flag=10;
setsockopt( sock, IPPROTO_TCP, TCP_KEEPCNT, (char*)&flag, sizeof(flag));

Like this, when my client (the Windows 2000 Telnet client) connect, and wait forever, I see the keepalive exchange. All seems ok, the TCP connection is maintained. But, if I cut the network between lwip and my pc, after 10sec, keepalive exchange become faster, and after 10 retry, the TCP connection is abort:

tcp_slowtmr: KEEPALIVE timeout. Aborting connection to 192.168.1.85.

I attach the network capture file for the first part of the test. Ethereal seems correctly "detect" keepalives packets. In this capture, 192.168.1.246 is my lwIP device (and 192.168.1.85 the PC).

So, if no objects about that, I will check in with 0 in TCP flags for tcp_keepalive...

(file #13012)

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Mon 11 Jun 2007 09:31:58 AM UTC, comment #3:

In http://www.freesoft.org/CIE/RFC/1122/114.htm, there is no lot of information about TCP header flags.

But I think Oleg is right. Srinivas, can you tell us if you have test with 0 in the flags?

Frédéric Bernon <fbernon>
Project MemberIn charge of this item.
Wed 06 Jun 2007 10:10:02 AM UTC, comment #2:

I think keep-alive packets should not send ACK flag.
Data are already acknowledged.
We need acknowledge only as reply to keep-alive packet.
So, it will be better TCPH_FLAGS_SET( tcphdr, 0);

Oleg Tyshev <olegreen>
Tue 05 Jun 2007 07:39:37 AM UTC, comment #1:

Looks like a bug to me, and a correct diagnosis and suggested fix. Thanks.

I'll apply this, but CVS isn't working for me at the moment.

Kieran Mansley <kieranm>
Project Administrator
Mon 04 Jun 2007 08:49:13 PM UTC, original submission:

Hello,
I'm using tcp keep-alive timer in my application. Whilst sending the keep-alive probes occasionally FIN and RST flags were
getting set in the outgoing segment.

In the tcp_keepalive()/tcp_out.c tcp flags field is not set.By setting the ack flag seems to fix the problem.
[ TCPH_FLAGS_SET( tcphdr, TCP_ACK );]

Could anyone confirm this problem and whether the above solution is correct or not?

Thanks,
-Srinivas.

Srinivas Gollakota <gollakota>

 

Attached Files
file #13013:  tcp_out.c.patch added by fbernon (766B - text/x-patch)
file #13012:  KeepAlive.cap added by fbernon (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by fbernon (Posted a comment)
  • -unavailable- added by olegreen (Posted a comment)
  • -unavailable- added by kieranm (Posted a comment)
  • -unavailable- added by gollakota (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 11 Jun 2007 01:54:39 PM UTCfbernonStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 11 Jun 2007 01:45:52 PM UTCfbernonAttached File-=>Added tcp_out.c.patch, #13013
      StatusNone=>Confirmed
      Assigned toNone=>fbernon
    Mon 11 Jun 2007 01:35:55 PM UTCfbernonAttached File-=>Added KeepAlive.cap, #13012

    Back to the top


    Powered by Savane 3.1-cleanup1