mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
sk-inet: save the socket option IPV6_V6ONLY (v2)
Most part of services (ssh, httpd, ...) create two separate sockets one for ipv4 and one for ipv6. If IPV6_V6ONLY isn't dumped, bind() returns EADDRINUSE v2: use do_dump_opt and initialize yes = 1 Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
6afafb12ca
commit
acf73093df
@ -18,4 +18,5 @@ message inet_sk_entry {
|
|||||||
|
|
||||||
required fown_entry fown = 13;
|
required fown_entry fown = 13;
|
||||||
required sk_opts_entry opts = 14;
|
required sk_opts_entry opts = 14;
|
||||||
|
optional bool v6only = 15;
|
||||||
}
|
}
|
||||||
|
16
sk-inet.c
16
sk-inet.c
@ -204,8 +204,17 @@ static int dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p)
|
|||||||
ie.n_src_addr = PB_ALEN_INET;
|
ie.n_src_addr = PB_ALEN_INET;
|
||||||
ie.n_dst_addr = PB_ALEN_INET;
|
ie.n_dst_addr = PB_ALEN_INET;
|
||||||
if (ie.family == AF_INET6) {
|
if (ie.family == AF_INET6) {
|
||||||
|
int val;
|
||||||
|
|
||||||
ie.n_src_addr = PB_ALEN_INET6;
|
ie.n_src_addr = PB_ALEN_INET6;
|
||||||
ie.n_dst_addr = PB_ALEN_INET6;
|
ie.n_dst_addr = PB_ALEN_INET6;
|
||||||
|
|
||||||
|
ret = dump_opt(lfd, SOL_IPV6, IPV6_V6ONLY, &val);
|
||||||
|
if (ret < 0)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
ie.v6only = val ? true : false;
|
||||||
|
ie.has_v6only = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ie.src_addr = xmalloc(pb_repeated_size(&ie, src_addr));
|
ie.src_addr = xmalloc(pb_repeated_size(&ie, src_addr));
|
||||||
@ -359,6 +368,13 @@ static int open_inet_sk(struct file_desc *d)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ii->ie->v6only) {
|
||||||
|
int yes = 1;
|
||||||
|
|
||||||
|
if (restore_opt(sk, SOL_IPV6, IPV6_V6ONLY, &yes) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (tcp_connection(ii->ie)) {
|
if (tcp_connection(ii->ie)) {
|
||||||
if (!opts.tcp_established_ok) {
|
if (!opts.tcp_established_ok) {
|
||||||
pr_err("Connected TCP socket in image\n");
|
pr_err("Connected TCP socket in image\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user