From: Tycho Andersen Date: Mon, 10 Aug 2015 17:12:19 +0000 (-0600) Subject: c/r: allow empty networks to be checkpointed/restored X-Git-Tag: lxc-1.1.3~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afab343e3bab26781f6ba24d6284610a07a204c3;p=thirdparty%2Flxc.git c/r: allow empty networks to be checkpointed/restored Empty networks don't have anything (besides lo) for us to dump and restore, so we should allow these as well. Reported-by: Dietmar Maurer Signed-off-by: Tycho Andersen Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/criu.c b/src/lxc/criu.c index e939b37b5..4ffa4e091 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -164,6 +164,9 @@ void exec_criu(struct criu_opts *opts) char eth[128], *veth; struct lxc_netdev *n = it->elem; + if (n->type != LXC_NET_VETH) + continue; + if (n->name) { if (strlen(n->name) >= sizeof(eth)) goto err; @@ -304,7 +307,12 @@ bool criu_ok(struct lxc_container *c) /* We only know how to restore containers with veth networks. */ lxc_list_for_each(it, &c->lxc_conf->network) { struct lxc_netdev *n = it->elem; - if (n->type != LXC_NET_VETH && n->type != LXC_NET_NONE) { + switch(n->type) { + case LXC_NET_VETH: + case LXC_NET_NONE: + case LXC_NET_EMPTY: + break; + default: ERROR("Found network that is not VETH or NONE\n"); return false; } @@ -402,6 +410,10 @@ static bool restore_net_info(struct lxc_container *c) lxc_list_for_each(it, &c->lxc_conf->network) { struct lxc_netdev *netdev = it->elem; char template[IFNAMSIZ]; + + if (netdev->type != LXC_NET_VETH) + continue; + snprintf(template, sizeof(template), "vethXXXXXX"); if (!netdev->priv.veth_attr.pair)