Wed 18 Feb 2009 12:24:14 PM UTC, original submission:
Problem description
===================
I'm trying to implement remote side network cable unplugging scenario by using keep-alive timer.
I set keep alive like:
pcb->so_options |= SOF_KEEPALIVE;
pcb->keep_idle = 15000;
pcb->keep_cnt = 1;
pcb->keep_intvl = 15000;
From wireshark, I can see my device is sending TCP keep alive packet. (Note: wireshark show with black color and marked as broken TCP.)
And remote side didn't ACK my keep-alive packet. (remote side is windows XP OS with telnet.exe running. my telnet implementation work fine)
so that my connection get keep-alive timed-out and disconnected.
Fix suggested by Kieran
=======================
Quote from Kieran:
There was a problem reported for a zero-window probes (which are very similar to the keep alive probes) where because we don't set the ACK flag windows hosts do not reply. The trace you provide shows that the keep alive probe doesn't have the ACK flag set, so I'd guess you've got the same problem. Could you try replacing, in src/core/tcp_out.c:tcp_keepalive():
tcphdr->ackno = htonl(pcb->rcv_nxt);
TCPH_FLAGS_SET(tcphdr, 0);
tcphdr->wnd = htons(pcb->rcv_ann_wnd);
tcphdr->urgp = 0;
with:
tcphdr->ackno = htonl(pcb->rcv_nxt);
TCPH_FLAGS_SET(tcphdr, TCP_ACK);
tcphdr->wnd = htons(pcb->rcv_ann_wnd + 1);
tcphdr->urgp = 0;
(I've also fixed the window in the packet with that change to not shrink
what we advertise by one octet).
If that works, please open a bug and this code should get checked in. We should really make the same change to the tcp_zero_window_probe() function below it which has the same block of code.
|