diff --git a/criu/sk-inet.c b/criu/sk-inet.c index 8e0050282..fb3939267 100644 --- a/criu/sk-inet.c +++ b/criu/sk-inet.c @@ -122,12 +122,6 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk) BUG_ON((sk->sd.family != AF_INET) && (sk->sd.family != AF_INET6)); if (sk->type == SOCK_DGRAM) { - if (sk->shutdown) { - pr_err("Can't dump shutdown inet socket %x\n", - sk->sd.ino); - return 0; - } - if (sk->wqlen != 0) { pr_err("Can't dump corked dgram socket %x\n", sk->sd.ino); @@ -414,6 +408,10 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa case IPPROTO_TCP: err = dump_one_tcp(lfd, sk); break; + case IPPROTO_UDP: + case IPPROTO_UDPLITE: + sk_encode_shutdown(&ie, sk->shutdown); + /* Fallthrough! */ default: err = 0; break; @@ -704,6 +702,16 @@ done: if (restore_socket_opts(sk, ie->opts)) goto err; + if (ie->has_shutdown && + (ie->proto == IPPROTO_UDP || + ie->proto == IPPROTO_UDPLITE)) { + if (shutdown(sk, sk_decode_shutdown(ie->shutdown))) { + pr_perror("Can't shutdown socket into %d", + sk_decode_shutdown(ie->shutdown)); + goto err; + } + } + *new_fd = sk; return 1; err: diff --git a/images/sk-inet.proto b/images/sk-inet.proto index 01dda875a..177f83fca 100644 --- a/images/sk-inet.proto +++ b/images/sk-inet.proto @@ -39,4 +39,5 @@ message inet_sk_entry { /* for ipv6, we need to send the ifindex to bind(); we keep the ifname * here and convert it on restore */ optional string ifname = 17; + optional sk_shutdown shutdown = 19; }