[CRIU] [PATCH 2/2] check: Check for ability to get tcp timestamp

Andrey Vagin avagin at openvz.org
Thu Feb 14 09:51:04 EST 2013


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-check.c        |  2 +-
 include/sk-inet.h |  2 +-
 sk-tcp.c          | 13 ++++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/cr-check.c b/cr-check.c
index 384923b..133c0be 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -474,7 +474,7 @@ int cr_check(void)
 	ret |= check_prctl();
 	ret |= check_fcntl();
 	ret |= check_proc_stat();
-	ret |= check_tcp_repair();
+	ret |= check_tcp();
 	ret |= check_fdinfo_ext();
 	ret |= check_unaligned_vmsplice();
 	ret |= check_tty();
diff --git a/include/sk-inet.h b/include/sk-inet.h
index 6aa1b70..ea24ab0 100644
--- a/include/sk-inet.h
+++ b/include/sk-inet.h
@@ -70,7 +70,7 @@ int restore_one_tcp(int sk, struct inet_sk_info *si);
 struct cr_options;
 void show_tcp_stream(int fd, struct cr_options *);
 
-int check_tcp_repair(void);
+int check_tcp(void);
 
 extern int rst_tcp_socks_size;
 extern int rst_tcp_socks_remap(void *addr);
diff --git a/sk-tcp.c b/sk-tcp.c
index 1a39125..9207a86 100644
--- a/sk-tcp.c
+++ b/sk-tcp.c
@@ -671,9 +671,11 @@ out:
 	pr_img_tail(CR_FD_TCP_STREAM);
 }
 
-int check_tcp_repair(void)
+int check_tcp(void)
 {
+	socklen_t optlen;
 	int sk, ret;
+	int val;
 
 	sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
 	if (sk < 0) {
@@ -682,6 +684,15 @@ int check_tcp_repair(void)
 	}
 
 	ret = tcp_repair_on(sk);
+	if (ret)
+		goto out;
+
+	optlen = sizeof(val);
+	ret = getsockopt(sk, SOL_TCP, TCP_TIMESTAMP, &val, &optlen);
+	if (ret)
+		pr_perror("Can't get TCP_TIMESTAMP");
+
+out:
 	close(sk);
 
 	return ret;
-- 
1.7.11.7



More information about the CRIU mailing list