[1/4] net: Support "dumping" dummy sit device

Submitted by Pavel Emelianov on July 5, 2017, 1:59 p.m.

Details

Message ID 1af1321a-14fc-24dc-fe4c-88564b562db3@virtuozzo.com
State Accepted
Series "SIT device support"
Headers show

Commit Message

Pavel Emelianov July 5, 2017, 1:59 p.m.
This device is an API endpoint, just skip it. Also, prepare the
ground for sit dump.

Issue #11

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/net.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/net.c b/criu/net.c
index 15aae2b..9dda92a 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -658,6 +658,31 @@  static int dump_one_gre(struct ifinfomsg *ifi, char *kind,
 	return dump_unknown_device(ifi, kind, tb, ns, fds);
 }
 
+static int dump_one_sit(struct ifinfomsg *ifi, char *kind,
+		struct nlattr **tb, struct ns_id *ns, struct cr_imgset *fds)
+{
+	char *name;
+
+	if (strcmp(kind, "sit")) {
+		pr_err("SIT device with %s kind\n", kind);
+		return -1;
+	}
+
+	name = (char *)RTA_DATA(tb[IFLA_IFNAME]);
+	if (!name) {
+		pr_err("sit device %d has no name\n", ifi->ifi_index);
+		return -1;
+	}
+
+	if (!strcmp(name, "sit0")) {
+		pr_info("found %s, ignoring\n", name);
+		return 0;
+	}
+
+	pr_warn("SIT device %s not supported natively\n", name);
+	return dump_unknown_device(ifi, kind, tb, ns, fds);
+}
+
 static int list_one_link(struct nlmsghdr *hdr, struct ns_id *ns, void *arg)
 {
 	return 0;
@@ -701,6 +726,9 @@  static int dump_one_link(struct nlmsghdr *hdr, struct ns_id *ns, void *arg)
 	case ARPHRD_IPGRE:
 		ret = dump_one_gre(ifi, kind, tb, ns, fds);
 		break;
+	case ARPHRD_SIT:
+		ret = dump_one_sit(ifi, kind, tb, ns, fds);
+		break;
 	default:
 unk:
 		ret = dump_unknown_device(ifi, kind, tb, ns, fds);