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 <[email protected]>
Signed-off-by: Tycho Andersen <[email protected]>
---
 src/lxc/criu.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index e1282e4..88dc8cd 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;
                }
@@ -351,6 +359,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)
-- 
2.1.4

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to