[CRIU] [PATCH 09/14] soccr/tcp: Prepare connection info for restore

Pavel Emelyanov xemul at virtuozzo.com
Mon Apr 18 06:05:33 PDT 2016


This is the first of "restoring" patches.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/sk-tcp.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/criu/sk-tcp.c b/criu/sk-tcp.c
index 6401c80..64fbbf0 100644
--- a/criu/sk-tcp.c
+++ b/criu/sk-tcp.c
@@ -445,6 +445,7 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 	int aux;
 	struct cr_img *img;
 	TcpStreamEntry *tse;
+	struct libsoccr_sk_data data = {};
 
 	pr_info("Restoring TCP connection id %x ino %x\n", ii->ie->id, ii->ie->ino);
 
@@ -455,6 +456,38 @@ static int restore_tcp_conn_state(int sk, struct libsoccr_sk *socr, struct inet_
 	if (pb_read_one(img, &tse, PB_TCP_STREAM) < 0)
 		goto err_c;
 
+	if (!tse->has_unsq_len) {
+		pr_err("No unsq len in the image\n");
+		goto err_c;
+	}
+
+	data.inq_len = tse->inq_len;
+	data.inq_seq = tse->inq_seq;
+	data.outq_len = tse->outq_len;
+	data.outq_seq = tse->outq_seq;
+	data.unsq_len = tse->unsq_len;
+	data.mss_clamp = tse->mss_clamp;
+	data.opt_mask = tse->opt_mask;
+	if (tse->opt_mask & TCPI_OPT_WSCALE) {
+		if (!tse->has_rcv_wscale) {
+			pr_err("No rcv wscale in the image\n");
+			goto err_c;
+		}
+
+		data.snd_wscale = tse->snd_wscale;
+		data.rcv_wscale = tse->rcv_wscale;
+	}
+	if (tse->opt_mask & TCPI_OPT_TIMESTAMPS) {
+		if (!tse->has_timestamp) {
+			pr_err("No timestamp in the image\n");
+			goto err_c;
+		}
+
+		data.timestamp = tse->timestamp;
+	}
+
+	(void)data;
+
 	if (restore_tcp_seqs(sk, tse))
 		goto err_c;
 
-- 
2.5.0



More information about the CRIU mailing list