[CRIU] [PATCH 2/2] netlink: Diag core and basic socket info dumping

Pavel Emelyanov xemul at parallels.com
Mon Mar 11 17:12:51 EDT 2013


On 03/11/2013 11:53 PM, Andrey Vagin wrote:
> The netlink_diag can be built as a module, just like it's done in unix sockets.
> 
> The core dumping message carries the basic info about netlink sockets:
> family, type and protocol, portis, groups[0], dst_group, dst_portid, state.
> 
> Here is only first part of groups[0], because nobody in kernel doesn't
> use groups upwards of 32. Later it can be expanded, if someone will
> require this.

Dave wouldn't like this.

> The socket inode number and cookie is reserved for future per-socket info
> retrieving. The per-protocol filtering is also reserved for future by
> requiring the sdiag_protocol to be zero.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---

> +static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
> +{
> +	int num = 0, s_num = cb->args[0];
> +	struct net *net = sock_net(skb->sk);
> +	struct netlink_diag_req *req;
> +	struct sock *sk;
> +	struct hlist_node *node;
> +	int i, j;
> +
> +	req = nlmsg_data(cb->nlh);
> +
> +	/* Make it possible to support protocol filtering later */
> +	if (req->sdiag_protocol)
> +		return -EINVAL;

I'd implement protocol filtering right now.

> +
> +	read_lock(&nl_table_lock);

Also prepare patch for iproute2 utility.


More information about the CRIU mailing list