[CRIU] Re: [PATCH 3/4] sockets: Restore unbound inet sockets v2

Pavel Emelyanov xemul at parallels.com
Wed May 30 05:00:27 EDT 2012


On 05/25/2012 01:09 PM, Cyrill Gorcunov wrote:
> 
> v2:
>  - Use do_dump_opt in dump_socket to not call
>    lookup_socket redundantly
> 
> p.s. probably the sockets params could be filled up
> in fd_parms, thus we can drop tests for socket family
> in gen_uncon_sk (could be cleaned up later)
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/sockets.h |    2 +
>  sk-inet.c         |  110 ++++++++++++++++++++++++++++++++++++++++++++++++----
>  sockets.c         |   11 ++---
>  3 files changed, 107 insertions(+), 16 deletions(-)
> 

> +	switch (sk->sd.family) {
> +	case AF_INET:
> +	case AF_INET6:
> +		break;
> +	default:
> +		pr_err("Unsupported socket family %d on %d\n",
> +		       sk->sd.family, p->fd);
> +		goto err;
> +	}
> +
> +	switch (sk->type) {
> +	case SOCK_DGRAM:
> +	case SOCK_STREAM:
> +		break;
> +	default:
> +		pr_err("Unsupported socket type %d on %d\n",
> +		       sk->type, p->fd);
> +		goto err;
> +	}
> +
> +	switch (sk->proto) {
> +	case IPPROTO_IP:
> +	case IPPROTO_TCP:
> +	case IPPROTO_UDP:
> +	case IPPROTO_UDPLITE:
> +		break;
> +	default:
> +		pr_err("Unsupported socket proto %d on %d\n",
> +		       sk->proto, p->fd);
> +		goto err;
> +	}

The can_dump_inet_sk checks most of the above.
Plus, you need to check that the state of the socket is unbound and unconnected
indeed. There are sockoptions for this.


More information about the CRIU mailing list