Commit 55519df9 authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Move inet sockets into files image

Reviewed-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent bee9eaca
...@@ -230,7 +230,7 @@ static int crtools_prepare_shared(void) ...@@ -230,7 +230,7 @@ static int crtools_prepare_shared(void)
return -1; return -1;
/* Connections are unlocked from criu */ /* Connections are unlocked from criu */
if (collect_inet_sockets()) if (!files_collected() && collect_image(&inet_sk_cinfo))
return -1; return -1;
if (collect_binfmt_misc()) if (collect_binfmt_misc())
......
...@@ -1688,6 +1688,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i) ...@@ -1688,6 +1688,9 @@ static int collect_one_file(void *o, ProtobufCMessage *base, struct cr_img *i)
case FD_TYPES__REG: case FD_TYPES__REG:
ret = collect_one_file_entry(fe, fe->reg->id, &fe->reg->base, &reg_file_cinfo); ret = collect_one_file_entry(fe, fe->reg->id, &fe->reg->base, &reg_file_cinfo);
break; break;
case FD_TYPES__INETSK:
ret = collect_one_file_entry(fe, fe->isk->id, &fe->isk->base, &inet_sk_cinfo);
break;
} }
return ret; return ret;
......
...@@ -58,7 +58,6 @@ enum { ...@@ -58,7 +58,6 @@ enum {
CR_FD_SK_QUEUES, CR_FD_SK_QUEUES,
CR_FD_EXT_FILES, CR_FD_EXT_FILES,
CR_FD_NS_FILES, CR_FD_NS_FILES,
CR_FD_INETSK,
CR_FD_UNIXSK, CR_FD_UNIXSK,
CR_FD_PACKETSK, CR_FD_PACKETSK,
CR_FD_NETLINK_SK, CR_FD_NETLINK_SK,
...@@ -106,6 +105,7 @@ enum { ...@@ -106,6 +105,7 @@ enum {
CR_FD_FANOTIFY_MARK, CR_FD_FANOTIFY_MARK,
CR_FD_EVENTPOLL_TFD, CR_FD_EVENTPOLL_TFD,
CR_FD_REG_FILES, CR_FD_REG_FILES,
CR_FD_INETSK,
CR_FD_AUTOFS, CR_FD_AUTOFS,
......
...@@ -33,7 +33,7 @@ extern bool socket_test_collect_bit(unsigned int family, unsigned int proto); ...@@ -33,7 +33,7 @@ extern bool socket_test_collect_bit(unsigned int family, unsigned int proto);
extern int sk_collect_one(unsigned ino, int family, struct socket_desc *d); extern int sk_collect_one(unsigned ino, int family, struct socket_desc *d);
struct ns_id; struct ns_id;
extern int collect_sockets(struct ns_id *); extern int collect_sockets(struct ns_id *);
extern int collect_inet_sockets(void); extern struct collect_image_info inet_sk_cinfo;
extern struct collect_image_info unix_sk_cinfo; extern struct collect_image_info unix_sk_cinfo;
extern int fix_external_unix_sockets(void); extern int fix_external_unix_sockets(void);
......
...@@ -306,6 +306,7 @@ static bool needs_scope_id(uint32_t *src_addr) ...@@ -306,6 +306,7 @@ static bool needs_scope_id(uint32_t *src_addr)
static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int family) static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int family)
{ {
struct inet_sk_desc *sk; struct inet_sk_desc *sk;
FileEntry fe = FILE_ENTRY__INIT;
InetSkEntry ie = INET_SK_ENTRY__INIT; InetSkEntry ie = INET_SK_ENTRY__INIT;
IpOptsEntry ipopts = IP_OPTS_ENTRY__INIT; IpOptsEntry ipopts = IP_OPTS_ENTRY__INIT;
SkOptsEntry skopts = SK_OPTS_ENTRY__INIT; SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
...@@ -419,7 +420,11 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa ...@@ -419,7 +420,11 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
ie.state = sk->state; ie.state = sk->state;
if (pb_write_one(img_from_set(glob_imgset, CR_FD_INETSK), &ie, PB_INET_SK)) fe.type = FD_TYPES__INETSK;
fe.id = ie.id;
fe.isk = &ie;
if (pb_write_one(img_from_set(glob_imgset, CR_FD_FILES), &fe, PB_FILE))
goto err; goto err;
err: err:
release_skopts(&skopts); release_skopts(&skopts);
...@@ -522,11 +527,6 @@ struct collect_image_info inet_sk_cinfo = { ...@@ -522,11 +527,6 @@ struct collect_image_info inet_sk_cinfo = {
.collect = collect_one_inetsk, .collect = collect_one_inetsk,
}; };
int collect_inet_sockets(void)
{
return collect_image(&inet_sk_cinfo);
}
static int inet_validate_address(InetSkEntry *ie) static int inet_validate_address(InetSkEntry *ie)
{ {
if ((ie->family == AF_INET) && if ((ie->family == AF_INET) &&
......
syntax = "proto2"; syntax = "proto2";
import "regfile.proto"; import "regfile.proto";
import "sk-inet.proto";
enum fd_types { enum fd_types {
UND = 0; UND = 0;
...@@ -34,4 +35,5 @@ message file_entry { ...@@ -34,4 +35,5 @@ message file_entry {
required fd_types type = 1; required fd_types type = 1;
required uint32 id = 2; required uint32 id = 2;
optional reg_file_entry reg = 3; optional reg_file_entry reg = 3;
optional inet_sk_entry isk = 4;
} }
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