History

tcp: add an ability to dump and restore window parameters

We found that sometimes a restored tcp socket doesn't work. A reason of this bug is incorrect window parameters and in this case tcp_acceptable_seq() returns tcp_wnd_end(tp) instead of tp->snd_nxt. The other side drops packets with this seq, because seq is less than tp->rcv_nxt ( tcp_sequence() ). Data from a send queue is sent only if there is enough space in a window, so when we restore unacked data, we need to expand a window to fit this data. This was in a first version of this patch: "tcp: extend window to fit all restored unacked data in a send queue" Then Alexey recommended me to restore window parameters instead of adjusted them according with data in a sent queue. This sounds resonable. rcv_wnd has to be restored, because it was reported to another side and the offered window is never shrunk. One of reasons why we need to restore snd_wnd was described above.

Andrey Vagin committed 10 years ago

Commit b1ed4c41 parent 641f7e42 files · +67 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/tcp.h+10−0
@@ -115,12 +115,22 @@ enum { · 114 unmodified lines
115115 #define TCP_CC_INFO 26 /* Get Congestion Control (optional) info */
116116 #define TCP_SAVE_SYN 27 /* Record SYN headers for new connections */
117117 #define TCP_SAVED_SYN 28 /* Get SYN headers recorded for connection */
118+#define TCP_REPAIR_WINDOW 29 /* Get/set window parameters */
118119
119120 struct tcp_repair_opt {
120121 __u32 opt_code;
121122 __u32 opt_val;
122123 };
123124
125+struct tcp_repair_window {
126+ __u32 snd_wl1;
127+ __u32 snd_wnd;
128+ __u32 max_window;
129+
130+ __u32 rcv_wnd;
131+ __u32 rcv_wup;
132+};
133+
124134 enum {
125135 TCP_NO_QUEUE,
126136 TCP_RECV_QUEUE,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t