diff --git a/Documentation/criu.txt b/Documentation/criu.txt index 55f05c000..39a66850f 100644 --- a/Documentation/criu.txt +++ b/Documentation/criu.txt @@ -199,6 +199,13 @@ Thus for command line argument the example above will look like: *--tcp-established*:: Checkpoint established TCP connections. +*--skip-in-flight*:: + This option skips in-flight TCP connections. If TCP connections + are found which are not yet completely established, criu will + ignore these connections in favor of erroring out. + The TCP stack on the client side is expected to handle the + re-connect gracefully. + *--veth-pair* ''*=*'':: Correspondence between outside and inside names of veth devices. diff --git a/criu/cr-service.c b/criu/cr-service.c index 0dc9c0cd6..0672a83db 100644 --- a/criu/cr-service.c +++ b/criu/cr-service.c @@ -322,6 +322,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req) if (req->has_tcp_established) opts.tcp_established_ok = req->tcp_established; + if (req->has_tcp_skip_in_flight) + opts.tcp_skip_in_flight = req->tcp_skip_in_flight; + if (req->has_evasive_devices) opts.evasive_devices = req->evasive_devices; diff --git a/images/rpc.proto b/images/rpc.proto index 1f74dcfb3..27583c14a 100644 --- a/images/rpc.proto +++ b/images/rpc.proto @@ -104,6 +104,7 @@ message criu_opts { optional string freeze_cgroup = 44; optional uint32 timeout = 45; + optional bool tcp_skip_in_flight = 46; } message criu_dump_resp { diff --git a/lib/c/criu.c b/lib/c/criu.c index 05425a38e..e75268cd2 100644 --- a/lib/c/criu.c +++ b/lib/c/criu.c @@ -309,6 +309,17 @@ void criu_set_tcp_established(bool tcp_established) criu_local_set_tcp_established(global_opts, tcp_established); } +void criu_local_set_tcp_skip_in_flight(criu_opts *opts, bool tcp_skip_in_flight) +{ + opts->rpc->has_tcp_skip_in_flight = true; + opts->rpc->tcp_skip_in_flight = tcp_skip_in_flight; +} + +void criu_set_tcp_skip_in_flight(bool tcp_skip_in_flight) +{ + criu_local_set_tcp_skip_in_flight(global_opts, tcp_skip_in_flight); +} + void criu_local_set_evasive_devices(criu_opts *opts, bool evasive_devices) { opts->rpc->has_evasive_devices = true; diff --git a/lib/c/criu.h b/lib/c/criu.h index 7ed1750d5..c28369fb6 100644 --- a/lib/c/criu.h +++ b/lib/c/criu.h @@ -65,6 +65,7 @@ void criu_set_leave_running(bool leave_running); void criu_set_ext_unix_sk(bool ext_unix_sk); int criu_add_unix_sk(unsigned int inode); void criu_set_tcp_established(bool tcp_established); +void criu_set_tcp_skip_in_flight(bool tcp_skip_in_flight); void criu_set_evasive_devices(bool evasive_devices); void criu_set_shell_job(bool shell_job); void criu_set_file_locks(bool file_locks); @@ -169,6 +170,7 @@ void criu_local_set_leave_running(criu_opts *opts, bool leave_running); void criu_local_set_ext_unix_sk(criu_opts *opts, bool ext_unix_sk); int criu_local_add_unix_sk(criu_opts *opts, unsigned int inode); void criu_local_set_tcp_established(criu_opts *opts, bool tcp_established); +void criu_local_set_tcp_skip_in_flight(criu_opts *opts, bool tcp_skip_in_flight); void criu_local_set_evasive_devices(criu_opts *opts, bool evasive_devices); void criu_local_set_shell_job(criu_opts *opts, bool shell_job); void criu_local_set_file_locks(criu_opts *opts, bool file_locks);