[CRIU] [PATCH] net: allow dumping of gre0 and gretap0

Tycho Andersen tycho.andersen at canonical.com
Mon Apr 4 15:40:25 PDT 2016


From: Tycho Andersen <tycho.andersen at canonical.com>

These devices are injected into every network namespace when the ip_gre
module is loaded. They cannot be configured as usable tunnels, so let's
just ignore them.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/net.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/criu/net.c b/criu/net.c
index faed2bd..6a1c404 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -281,6 +281,21 @@ static int dump_one_ethernet(struct ifinfomsg *ifi, char *kind,
 		return dump_one_netdev(ND_TYPE__TUN, ifi, tb, fds, dump_tun_link);
 	if (!strcmp(kind, "bridge"))
 		return dump_one_netdev(ND_TYPE__BRIDGE, ifi, tb, fds, dump_bridge);
+	if (!strcmp(kind, "gretap")) {
+		char *name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
+
+		if (!name) {
+			pr_err("gretap %d has no name\n", ifi->ifi_index);
+			return -1;
+		}
+
+		if (!strcmp(name, "gretap0")) {
+			pr_info("found %s, ignoring\n", name);
+			return 0;
+		}
+
+		pr_warn("GRE tap device %s not supported natively\n", name);
+	}
 
 	return dump_unknown_device(ifi, kind, tb, fds);
 }
@@ -303,6 +318,27 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
 	return dump_unknown_device(ifi, kind, tb, fds);
 }
 
+static int dump_one_gre(struct ifinfomsg *ifi, char *kind,
+		struct nlattr **tb, struct cr_imgset *fds)
+{
+	if (!strcmp(kind, "gre")) {
+		char *name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
+		if (!name) {
+			pr_err("gre device %d has no name\n", ifi->ifi_index);
+			return -1;
+		}
+
+		if (!strcmp(name, "gre0")) {
+			pr_info("found %s, ignoring\n", name);
+			return 0;
+		}
+
+		pr_warn("GRE tunnel device %s not supported natively\n", name);
+	}
+
+	return dump_unknown_device(ifi, kind, tb, fds);
+}
+
 static int dump_one_link(struct nlmsghdr *hdr, void *arg)
 {
 	struct cr_imgset *fds = arg;
@@ -338,6 +374,9 @@ static int dump_one_link(struct nlmsghdr *hdr, void *arg)
 	case ARPHRD_VOID:
 		ret = dump_one_voiddev(ifi, kind, tb, fds);
 		break;
+	case ARPHRD_IPGRE:
+		ret = dump_one_gre(ifi, kind, tb, fds);
+		break;
 	default:
 unk:
 		ret = dump_unknown_device(ifi, kind, tb, fds);
-- 
2.7.3



More information about the CRIU mailing list