Commit fe3fb885 authored by Pavel Emelyanov's avatar Pavel Emelyanov

tcp: Support CORK and NODELAY options

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4b6e1d6d
...@@ -9,4 +9,7 @@ message tcp_stream_entry { ...@@ -9,4 +9,7 @@ message tcp_stream_entry {
required uint32 mss_clamp = 7; required uint32 mss_clamp = 7;
optional uint32 rcv_wscale = 8; optional uint32 rcv_wscale = 8;
optional uint32 timestamp = 9; optional uint32 timestamp = 9;
optional bool cork = 10;
optional bool nodelay = 11;
} }
...@@ -301,7 +301,7 @@ err_sopt: ...@@ -301,7 +301,7 @@ err_sopt:
static int dump_tcp_conn_state(struct inet_sk_desc *sk) static int dump_tcp_conn_state(struct inet_sk_desc *sk)
{ {
int ret, img_fd; int ret, img_fd, aux;
TcpStreamEntry tse = TCP_STREAM_ENTRY__INIT; TcpStreamEntry tse = TCP_STREAM_ENTRY__INIT;
char *in_buf, *out_buf; char *in_buf, *out_buf;
...@@ -336,6 +336,26 @@ static int dump_tcp_conn_state(struct inet_sk_desc *sk) ...@@ -336,6 +336,26 @@ static int dump_tcp_conn_state(struct inet_sk_desc *sk)
if (ret < 0) if (ret < 0)
goto err_opt; goto err_opt;
/*
* TCP socket options
*/
if (dump_opt(sk->rfd, SOL_TCP, TCP_NODELAY, &aux))
goto err_opt;
if (aux) {
tse.has_nodelay = true;
tse.nodelay = true;
}
if (dump_opt(sk->rfd, SOL_TCP, TCP_CORK, &aux))
goto err_opt;
if (aux) {
tse.has_cork = true;
tse.cork = true;
}
/* /*
* Push the stuff to image * Push the stuff to image
*/ */
...@@ -522,7 +542,7 @@ static int restore_tcp_opts(int sk, TcpStreamEntry *tse) ...@@ -522,7 +542,7 @@ static int restore_tcp_opts(int sk, TcpStreamEntry *tse)
static int restore_tcp_conn_state(int sk, struct inet_sk_info *ii) static int restore_tcp_conn_state(int sk, struct inet_sk_info *ii)
{ {
int ifd; int ifd, aux;
TcpStreamEntry *tse; TcpStreamEntry *tse;
pr_info("Restoring TCP connection id %x ino %x\n", ii->ie->id, ii->ie->ino); pr_info("Restoring TCP connection id %x ino %x\n", ii->ie->id, ii->ie->ino);
...@@ -549,6 +569,18 @@ static int restore_tcp_conn_state(int sk, struct inet_sk_info *ii) ...@@ -549,6 +569,18 @@ static int restore_tcp_conn_state(int sk, struct inet_sk_info *ii)
if (restore_tcp_queues(sk, tse, ifd)) if (restore_tcp_queues(sk, tse, ifd))
goto err_c; goto err_c;
if (tse->has_nodelay && tse->nodelay) {
aux = 1;
if (restore_opt(sk, SOL_TCP, TCP_NODELAY, &aux))
goto err_c;
}
if (tse->has_cork && tse->cork) {
aux = 1;
if (restore_opt(sk, SOL_TCP, TCP_CORK, &aux))
goto err_c;
}
tcp_stream_entry__free_unpacked(tse, NULL); tcp_stream_entry__free_unpacked(tse, NULL);
close(ifd); close(ifd);
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment