slirp updates (2)

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJW/aJcAAoJEOPlHOj7ay8dPiMQAKVl1tBzK0lovRoX7utt3IMF
 nA2eJb4cU60kPqVS3gCuPNkpvNvV+/LfySdF/iynLNPQpGyCs7k8nPaql/m2jXBX
 mx6uV+jTztrCMee7it43deLkKBLD8G/jOpjY9NhxQuHXS+lRCX3ELaMPfh9ympCX
 Jzc2F079rJmdzni4MTQJxlP3SLp03Vloo3ZQJrkjyWZiH48fMOpvC2I0nGywTolL
 hklaf/HkfrjNpCnQ4zEmIz69oWf4EbrtwrHfGZsmQQ0BB4TdnopqTY9xnUxu7wnS
 DUhNa53IqVb1COQ8wKwIbn5LYRIjZwFhFq2ubDD0boAzB9kYfxaNErZNft8WGBKG
 rXY0L8Y0DKtdxKjvQVUPuwUmHBcsxybAPKGQ1SnIFE3PSnsb+6TEqLa8RYmm78HO
 CA4mkNCA72tkbgHsst8GjVtXYJSKxo3SMrG1RoPKoq8BcN2cCZ+gSZdruD30WHvN
 js9s7+Y+6reiAqqoO0af0PSbItaC3yeFWXPRoXxslfC/q7wOpTiBXLfxBozgZoQK
 BUunomkebENHLzDCT9xJd73NReMpZ7Zrf+imn+IPb7hoFJi74LkGy7/1YTLhKnU+
 xQojtbI13q8kzVJKvZX4cs1DWs38TPMmNCQowd7zDg3W3tk6BLEsGiHUdXLZtVY4
 6O7OGl9fTA4PcZNVZErf
 =d+t5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault-2' into staging

slirp updates (2)

# gpg: Signature made Thu 31 Mar 2016 23:19:08 BST using RSA key ID FB6B2F1D
# gpg: Good signature from "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg:                 aka "Samuel Thibault <sthibault@debian.org>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg:                 aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82  304B D017 8C76 7D06 9EE6
#      Subkey fingerprint: F632 74CD C630 0873 CB3D  29D9 E3E5 1CE8 FB6B 2F1D

* remotes/thibault/tags/samuel-thibault-2:
  slirp: Fix migration from older versions of QEMU to the current one

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-04-01 11:15:20 +01:00
commit de1d099a44

View File

@ -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;