All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Smith <danms@us.ibm.com>
To: containers@lists.osdl.org, netdev@vger.kernel.org
Subject: [PATCH 5/5] Add a checkpoint handler to the 'sit' device
Date: Tue, 16 Feb 2010 08:03:07 -0800	[thread overview]
Message-ID: <1266336187-19105-6-git-send-email-danms@us.ibm.com> (raw)
In-Reply-To: <1266336187-19105-1-git-send-email-danms@us.ibm.com>

This handler doesn't really do much to checkpoint the device, other
than the minimum required to support the restart process.  When we
add IPv6 support to this, then we can fill this out.

This allows us to avoid skipping unsupported interfaces on a normal
system.

Signed-off-by: Dan Smith <danms@us.ibm.com>
---
 net/ipv6/sit.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 976e682..a9fc331 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -32,6 +32,8 @@
 #include <linux/init.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/if_ether.h>
+#include <linux/checkpoint.h>
+#include <linux/checkpoint_hdr.h>
 
 #include <net/sock.h>
 #include <net/snmp.h>
@@ -1085,11 +1087,39 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu)
 	return 0;
 }
 
+static int ipip6_checkpoint(struct ckpt_ctx *ctx, struct net_device *dev)
+{
+	struct ckpt_hdr_netdev *h;
+	struct ckpt_netdev_addr *addrs;
+	int ret;
+
+	h = ckpt_netdev_base(ctx, dev, &addrs);
+	if (IS_ERR(h))
+		return PTR_ERR(h);
+
+	h->type = CKPT_NETDEV_SIT;
+
+	ret = ckpt_write_obj(ctx, (struct ckpt_hdr *) h);
+	if (ret < 0)
+		goto out;
+
+	if (h->inet_addrs > 0) {
+		int len = (sizeof(struct ckpt_netdev_addr) * h->inet_addrs);
+		ret = ckpt_write_buffer(ctx, addrs, len);
+	}
+ out:
+	ckpt_hdr_put(ctx, h);
+	kfree(addrs);
+
+	return ret;
+}
+
 static const struct net_device_ops ipip6_netdev_ops = {
 	.ndo_uninit	= ipip6_tunnel_uninit,
 	.ndo_start_xmit	= ipip6_tunnel_xmit,
 	.ndo_do_ioctl	= ipip6_tunnel_ioctl,
 	.ndo_change_mtu	= ipip6_tunnel_change_mtu,
+	.ndo_checkpoint	= ipip6_checkpoint,
 };
 
 static void ipip6_tunnel_setup(struct net_device *dev)
-- 
1.6.2.5


      parent reply	other threads:[~2010-02-16 16:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 16:03 Network device and namespace checkpoint/restart (v3) Dan Smith
2010-02-16 16:03 ` [PATCH 1/5] Add checkpoint and collect hooks to net_device_ops Dan Smith
2010-02-16 16:03 ` [PATCH 2/5] C/R: Basic support for network namespaces and devices (v4) Dan Smith
     [not found]   ` <20100222194523.GA13135@us.ibm.com>
2010-02-23 16:35     ` Dan Smith
2010-02-23 16:47       ` Serge E. Hallyn
2010-02-23 17:27         ` Dan Smith
2010-02-23 18:49           ` Serge E. Hallyn
2010-02-16 16:03 ` [PATCH 3/5] Add checkpoint support for veth devices (v2) Dan Smith
     [not found]   ` <1266336187-19105-4-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-02-22 19:56     ` Serge E. Hallyn
2010-02-22 20:25       ` Dan Smith
2010-02-22 20:57         ` Serge E. Hallyn
2010-02-22 21:01           ` Dan Smith
2010-02-16 16:03 ` [PATCH 4/5] Add loopback checkpoint support Dan Smith
2010-02-16 16:09   ` Eric Dumazet
2010-02-16 16:13     ` Dan Smith
2010-02-16 16:03 ` Dan Smith [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1266336187-19105-6-git-send-email-danms@us.ibm.com \
    --to=danms@us.ibm.com \
    --cc=containers@lists.osdl.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.