From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: [PATCH 1/4] Record and restore skb header marks
Date: Wed, 21 Oct 2009 10:52:02 -0500 [thread overview]
Message-ID: <20091021155201.GA15402@us.ibm.com> (raw)
In-Reply-To: <1256072803-3518-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> Save this information when we checkpoint an skb and provide a mechanism
> to restore that information on restart. This will be used in the
> subsequent INET patch.
>
> Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> include/linux/checkpoint.h | 2 ++
> include/linux/checkpoint_hdr.h | 7 +++++++
> net/checkpoint.c | 33 +++++++++++++++++++++++++++++++++
> 3 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
> index 4b61378..1da0b04 100644
> --- a/include/linux/checkpoint.h
> +++ b/include/linux/checkpoint.h
> @@ -100,6 +100,8 @@ extern int ckpt_sock_getnames(struct ckpt_ctx *ctx,
> struct socket *socket,
> struct sockaddr *loc, unsigned *loc_len,
> struct sockaddr *rem, unsigned *rem_len);
> +void sock_restore_header_info(struct sk_buff *skb,
> + struct ckpt_hdr_socket_buffer *h);
>
> /* ckpt kflags */
> #define ckpt_set_ctx_kflag(__ctx, __kflag) \
> diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
> index ca2500d..3e6cab1 100644
> --- a/include/linux/checkpoint_hdr.h
> +++ b/include/linux/checkpoint_hdr.h
> @@ -542,8 +542,15 @@ struct ckpt_hdr_socket_queue {
>
> struct ckpt_hdr_socket_buffer {
> struct ckpt_hdr h;
> + __u64 mac_len;
> + __u64 hdr_len;
> + __u64 transport_header;
> + __u64 network_header;
> + __u64 mac_header;
> __s32 sk_objref;
> __s32 pr_objref;
> + __u16 protocol;
> + __u8 cb[48];
> };
>
> #define CKPT_UNIX_LINKED 1
> diff --git a/net/checkpoint.c b/net/checkpoint.c
> index dd23efd..5ed2724 100644
> --- a/net/checkpoint.c
> +++ b/net/checkpoint.c
> @@ -88,6 +88,38 @@ static int sock_copy_buffers(struct sk_buff_head *from,
> return -EAGAIN;
> }
>
> +static void sock_record_header_info(struct sk_buff *skb,
> + struct ckpt_hdr_socket_buffer *h)
> +{
> +
> + h->mac_len = skb->mac_len;
> + h->hdr_len = skb->hdr_len;
> +
> +#ifdef NET_SKBUFF_DATA_USES_OFFSET
> + h->transport_header = skb->transport_hdr;
> + h->network_header = skb->network_header;
> + h->mac_header = skb->mac_header;
> +#else
> + h->transport_header = skb->transport_header - skb->head;
> + h->network_header = skb->network_header - skb->head;
> + h->mac_header = skb->mac_header - skb->head;
> +#endif
> +
> + memcpy(h->cb, skb->cb, sizeof(skb->cb));
> +}
> +
> +void sock_restore_header_info(struct sk_buff *skb,
> + struct ckpt_hdr_socket_buffer *h)
> +{
> + skb->mac_len = h->mac_len;
> + skb->hdr_len = h->hdr_len;
> + skb_set_transport_header(skb, h->transport_header);
> + skb_set_network_header(skb, h->network_header);
> + skb_set_mac_header(skb, h->mac_header);
Should you verify that each of these new headers is located
inside the skb?
> +
> + memcpy(skb->cb, h->cb, sizeof(skb->cb));
verify that (h->h.len - (h->cb - h->h)) > sizeof(skb->cb)) ?
> +}
> +
> static int __sock_write_buffers(struct ckpt_ctx *ctx,
> struct sk_buff_head *queue,
> int dst_objref)
> @@ -123,6 +155,7 @@ static int __sock_write_buffers(struct ckpt_ctx *ctx,
> goto end;
> h->sk_objref = ret;
> h->pr_objref = dst_objref;
> + sock_record_header_info(skb, h);
>
> ret = ckpt_write_obj(ctx, (struct ckpt_hdr *) h);
> if (ret < 0)
> --
> 1.6.2.5
>
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2009-10-21 15:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-20 21:06 c/r: Add support for connected AF_INET sockets Dan Smith
2009-10-20 21:06 ` [PATCH 2/4] [RFC] Add c/r support for connected INET sockets Dan Smith
2009-10-21 17:56 ` Serge E. Hallyn
2009-10-21 18:05 ` Dan Smith
2009-10-23 19:37 ` Oren Laadan
[not found] ` <1256072803-3518-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-20 21:06 ` [PATCH 1/4] Record and restore skb header marks Dan Smith
[not found] ` <1256072803-3518-2-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-21 15:52 ` Serge E. Hallyn [this message]
[not found] ` <20091021155201.GA15402-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-21 15:57 ` Dan Smith
2009-10-20 21:06 ` [PATCH 3/4] Adjust TCP timestamp values by a scalar value Dan Smith
[not found] ` <1256072803-3518-4-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-21 18:06 ` Serge E. Hallyn
[not found] ` <20091021180638.GA24465-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-21 18:10 ` Dan Smith
2009-10-20 21:06 ` [PATCH 4/4] Add some content to the readme.txt for socket c/r Dan Smith
[not found] ` <1256072803-3518-5-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-23 19:41 ` Oren Laadan
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=20091021155201.GA15402@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox