mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-18 00:58:31 +00:00
tcp: Add code for "check"-ing TCP repair support
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
1dc8527dea
commit
4ec76b285f
3 changed files with 22 additions and 1 deletions
|
|
@ -8,6 +8,8 @@
|
|||
#include "log.h"
|
||||
#include "util-net.h"
|
||||
#include "syscall.h"
|
||||
#include "files.h"
|
||||
#include "sk-inet.h"
|
||||
|
||||
static int check_map_files(void)
|
||||
{
|
||||
|
|
@ -150,6 +152,7 @@ int cr_check(void)
|
|||
ret |= check_prctl();
|
||||
ret |= check_fcntl();
|
||||
ret |= check_proc_stat();
|
||||
ret |= check_tcp_repair();
|
||||
|
||||
if (!ret)
|
||||
pr_msg("Looks good.\n");
|
||||
|
|
|
|||
|
|
@ -39,4 +39,6 @@ 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);
|
||||
#endif
|
||||
|
|
|
|||
18
sk-tcp.c
18
sk-tcp.c
|
|
@ -46,7 +46,7 @@ static int tcp_repair_on(int fd)
|
|||
|
||||
ret = setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux));
|
||||
if (ret < 0)
|
||||
pr_perror("Can't turn repair ON");
|
||||
pr_perror("Can't turn TCP repair mode ON");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -537,3 +537,19 @@ void show_tcp_stream(int fd, struct cr_options *opt)
|
|||
|
||||
pr_img_tail(CR_FD_TCP_STREAM);
|
||||
}
|
||||
|
||||
int check_tcp_repair(void)
|
||||
{
|
||||
int sk, ret;
|
||||
|
||||
sk = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (sk < 0) {
|
||||
pr_perror("Can't create TCP socket :(\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = tcp_repair_on(sk);
|
||||
close(sk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue