From: Samuel Thibault <samuel.thibault@gnu.org>
To: Thomas Huth <thuth@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] slirp: Fix migration from older versions of QEMU to the current one
Date: Fri, 1 Apr 2016 00:00:43 +0200 [thread overview]
Message-ID: <20160331220043.GN2749@var.home> (raw)
In-Reply-To: <1459435721-21351-1-git-send-email-thuth@redhat.com>
Thomas Huth, on Thu 31 Mar 2016 16:48:41 +0200, wrote:
> While adding the IPv6 support, the commit eae303ff23f51259eddc8856c71453d8
> ("slirp: Make Socket structure IPv6 compatible") changed the format of
> the migration stream, without taking into account that we might still
> receive an old migration stream layout when upgrading from QEMU version
> 2.5 (or older) to QEMU 2.6. Currently, QEMU bails out when doing a
> migration from QEMU 2.5 to the recent master version when it has
> been started with a "-net user,guestfwd=..." network. So let's fix
> this by checking the version ID of the migration stream and by using
> the old behavior if we've detected version 3 or less.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Just realizing... We'd need to add AF_INET6 cases here too, to be able
to save/restore a VM using ipv6 connections.
> ---
> slirp/slirp.c | 44 ++++++++++++++++++++++++++------------------
> 1 file changed, 26 insertions(+), 18 deletions(-)
>
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 3481fcc..998f278 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -1233,31 +1233,39 @@ static int slirp_sbuf_load(QEMUFile *f, struct sbuf *sbuf)
> return 0;
> }
>
> -static int slirp_socket_load(QEMUFile *f, struct socket *so)
> +static int slirp_socket_load(QEMUFile *f, struct socket *so, int version_id)
> {
> if (tcp_attach(so) < 0)
> return -ENOMEM;
>
> so->so_urgc = qemu_get_be32(f);
> - so->so_ffamily = qemu_get_be16(f);
> - switch (so->so_ffamily) {
> - case AF_INET:
> + if (version_id <= 3) {
> + so->so_ffamily = AF_INET;
> so->so_faddr.s_addr = qemu_get_be32(f);
> - so->so_fport = qemu_get_be16(f);
> - break;
> - default:
> - error_report(
> - "so_ffamily unknown, unable to restore so_faddr and so_lport\n");
> - }
> - so->so_lfamily = qemu_get_be16(f);
> - switch (so->so_lfamily) {
> - case AF_INET:
> so->so_laddr.s_addr = qemu_get_be32(f);
> + so->so_fport = qemu_get_be16(f);
> so->so_lport = qemu_get_be16(f);
> - break;
> - default:
> - error_report(
> - "so_ffamily unknown, unable to restore so_laddr and so_lport\n");
> + } else {
> + so->so_ffamily = qemu_get_be16(f);
> + switch (so->so_ffamily) {
> + case AF_INET:
> + so->so_faddr.s_addr = qemu_get_be32(f);
> + so->so_fport = qemu_get_be16(f);
> + break;
> + default:
> + error_report(
> + "so_ffamily unknown, unable to restore so_faddr and so_lport");
> + }
> + so->so_lfamily = qemu_get_be16(f);
> + switch (so->so_lfamily) {
> + case AF_INET:
> + so->so_laddr.s_addr = qemu_get_be32(f);
> + so->so_lport = qemu_get_be16(f);
> + break;
> + default:
> + error_report(
> + "so_ffamily unknown, unable to restore so_laddr and so_lport");
> + }
> }
> so->so_iptos = qemu_get_byte(f);
> so->so_emu = qemu_get_byte(f);
> @@ -1294,7 +1302,7 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)
> if (!so)
> return -ENOMEM;
>
> - ret = slirp_socket_load(f, so);
> + ret = slirp_socket_load(f, so, version_id);
>
> if (ret < 0)
> return ret;
> --
> 1.8.3.1
>
--
Samuel
requests.</FONT></SPAN></TD></TR></TBODY></TABLE></DIV></BODY></HTML>agnjo
gj a po mi
shnthdrdcvallus hsx mvgduwolgfwtq
uzuy
s
p
h
-+- spams forever ... -+-
next prev parent reply other threads:[~2016-03-31 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 14:48 [Qemu-devel] [PATCH] slirp: Fix migration from older versions of QEMU to the current one Thomas Huth
2016-03-31 22:00 ` Samuel Thibault [this message]
2016-03-31 22:22 ` Samuel Thibault
2016-04-01 8:00 ` Thomas Huth
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=20160331220043.GN2749@var.home \
--to=samuel.thibault@gnu.org \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).