[CRIU] [PATCH 11/12] net: dump and restore connected to a bridge links

Pavel Emelyanov xemul at virtuozzo.com
Mon Mar 13 03:58:02 PDT 2017


> @@ -1369,37 +1344,110 @@ exit:
>  	return ret;
>  }
>  
> -static int restore_links()
> +static int restore_master_link(int nlsk, struct ns_id *ns, struct net_link *link)
> +{
> +	struct newlink_req req;
> +
> +	memset(&req, 0, sizeof(req));
> +
> +	req.h.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
> +	req.h.nlmsg_flags = NLM_F_REQUEST|NLM_F_ACK|NLM_F_CREATE;
> +	req.h.nlmsg_type = RTM_SETLINK;
> +	req.h.nlmsg_seq = CR_NLMSG_SEQ;
> +	req.i.ifi_family = AF_PACKET;
> +	req.i.ifi_index = link->nde->ifindex;
> +	req.i.ifi_flags = link->nde->flags;
> +
> +	addattr_l(&req.h, sizeof(req), IFLA_MASTER,
> +			&link->nde->master, sizeof(link->nde->master));
> +
> +	return do_rtnl_req(nlsk, &req, req.h.nlmsg_len, restore_link_cb, NULL, NULL, NULL);

This is move_to_bridge() isn't it? Can we factor this out?

> +}
> +
> +struct net_link *lookup_net_link(struct ns_id *ns, uint32_t ifindex)
> +{
> +	struct net_link *link;
> +
> +	list_for_each_entry(link, &ns->net.links, node)
> +		if (link->nde->ifindex == ifindex)
> +			return link;
> +
> +	return NULL;
> +}
> +



More information about the CRIU mailing list