[CRIU] [PATCH 6/7] net: allow checkpoint/restore if sit devices

Tycho Andersen tycho.andersen at canonical.com
Thu Feb 18 08:08:55 PST 2016


I really have no idea if I'm missing something here, as I don't know
anything about these tunnels. But, this patch at least is a start on c/r
for sit devices.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 criu/net.c          | 27 ++++++++++++++++++++++++++-
 images/netdev.proto |  2 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/criu/net.c b/criu/net.c
index cf1e821..50e1b0e 100644
--- a/criu/net.c
+++ b/criu/net.c
@@ -169,7 +169,7 @@ static int dump_one_netdev(int type, struct ifinfomsg *ifi,
 	netdev.flags = ifi->ifi_flags;
 	netdev.name = RTA_DATA(tb[IFLA_IFNAME]);
 
-	if (tb[IFLA_ADDRESS] && (type != ND_TYPE__LOOPBACK)) {
+	if (tb[IFLA_ADDRESS] && (type != ND_TYPE__LOOPBACK) && (type != ND_TYPE__SIT)) {
 		netdev.has_address = true;
 		netdev.address.data = RTA_DATA(tb[IFLA_ADDRESS]);
 		netdev.address.len = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
@@ -303,6 +303,15 @@ static int dump_one_voiddev(struct ifinfomsg *ifi, char *kind,
 	return dump_unknown_device(ifi, kind, tb, fds);
 }
 
+static int dump_one_sit(struct ifinfomsg *ifi, char *kind,
+		struct rtattr **tb, struct cr_imgset *fds)
+{
+	if (!strcmp(kind, "sit"))
+		return dump_one_netdev(ND_TYPE__SIT, ifi, tb, fds, NULL);
+
+	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 +347,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_SIT:
+		ret = dump_one_sit(ifi, kind, tb, fds);
+		break;
 	default:
 unk:
 		ret = dump_unknown_device(ifi, kind, tb, fds);
@@ -686,6 +698,17 @@ static int bridge_link_info(NetDeviceEntry *nde, struct newlink_req *req)
 	return 0;
 }
 
+static int sit_link_info(NetDeviceEntry *nde, struct newlink_req *req)
+{
+	struct rtattr *sit_data;
+
+	sit_data = NLMSG_TAIL(&req->h);
+	addattr_l(&req->h, sizeof(*req), IFLA_INFO_KIND, "sit", sizeof("sit"));
+	sit_data->rta_len = (void *)NLMSG_TAIL(&req->h) - (void *)sit_data;
+
+	return 0;
+}
+
 static int restore_link(NetDeviceEntry *nde, int nlsk)
 {
 	pr_info("Restoring link %s type %d\n", nde->name, nde->type);
@@ -702,6 +725,8 @@ static int restore_link(NetDeviceEntry *nde, int nlsk)
 		return restore_one_tun(nde, nlsk);
 	case ND_TYPE__BRIDGE:
 		return restore_one_link(nde, nlsk, bridge_link_info);
+	case ND_TYPE__SIT:
+		return restore_one_link(nde, nlsk, sit_link_info);
 
 	default:
 		pr_err("Unsupported link type %d\n", nde->type);
diff --git a/images/netdev.proto b/images/netdev.proto
index dafa2bd..bc8a229 100644
--- a/images/netdev.proto
+++ b/images/netdev.proto
@@ -17,6 +17,8 @@ enum nd_type {
 	 */
 	VENET		= 5;
 	BRIDGE		= 6;
+	/* ipv4 over ipv6 tunnel */
+	SIT		= 7;
 }
 
 message net_device_entry {
-- 
2.6.4



More information about the CRIU mailing list