[CRIU] [PATCH 05/10] net: save network namespaces for sockets
Pavel Emelyanov
xemul at virtuozzo.com
Mon Oct 17 04:44:07 PDT 2016
On 09/01/2016 01:55 AM, Andrei Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
>
> Each socket has to be restored in a proper namespaces where
> it has been created.
>
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
> criu/include/sockets.h | 10 ++++++++--
> criu/sk-inet.c | 18 +++++++++++++++---
> criu/sk-netlink.c | 15 ++++++++++++++-
> criu/sk-packet.c | 6 +++++-
> criu/sk-unix.c | 9 ++++++---
> criu/sockets.c | 35 +++++++++++++++++++++++------------
> images/packet-sock.proto | 1 +
> images/sk-inet.proto | 1 +
> images/sk-netlink.proto | 1 +
> images/sk-packet.proto | 1 +
> images/sk-unix.proto | 2 ++
> 11 files changed, 77 insertions(+), 22 deletions(-)
>
> diff --git a/criu/include/sockets.h b/criu/include/sockets.h
> index 40295bb..fc64ac2 100644
> --- a/criu/include/sockets.h
> +++ b/criu/include/sockets.h
> @@ -21,9 +21,15 @@ struct socket_desc {
> unsigned int family;
> unsigned int ino;
> struct socket_desc *next;
> + struct ns_id *ns;
Let's name is sk_ns for easier grepping.
> int already_dumped;
> };
>
> +struct sock_req_args {
> + struct ns_id *ns;
The ns_id as a generic argument to do_collect_req()'s receive_callback
looks good enough.
> + void *req;
> +};
> +
> extern int dump_socket(struct fd_parms *p, int lfd, struct cr_img *);
> extern int dump_socket_opts(int sk, SkOptsEntry *soe);
> extern int restore_socket_opts(int sk, SkOptsEntry *soe);
More information about the CRIU
mailing list