From ea9ac12820138a0a9714178bee36e625ed103026 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Mon, 20 May 2019 17:57:02 +0200
Subject: [PATCH 1/3] slirp: fix big/little endian conversion in ident protocol
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: <20190520175704.6250-2-marcandre.lureau@redhat.com>
Patchwork-id: 88107
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 1/3] slirp: fix big/little endian conversion in ident protocol
Bugzilla: 1669071
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[ MA - backported to ease backport of
https://bugzilla.redhat.com/show_bug.cgi?id=1669068 ]
(cherry picked from 1fd71067dae501f1c78618e9583c6cc72db0cfa6)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
slirp/tcp_subr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
index 98ceb4f..a61632d 100644
--- a/slirp/tcp_subr.c
+++ b/slirp/tcp_subr.c
@@ -656,10 +656,12 @@ tcp_emu(struct socket *so, struct mbuf *m)
tmpso->so_fport == n1) {
if (getsockname(tmpso->s,
(struct sockaddr *)&addr, &addrlen) == 0)
- n2 = ntohs(addr.sin_port);
+ n2 = addr.sin_port;
break;
}
}
+ NTOHS(n1);
+ NTOHS(n2);
so_rcv->sb_cc = snprintf(so_rcv->sb_data,
so_rcv->sb_datalen,
"%d,%d\r\n", n1, n2);
--
1.8.3.1