|
|
255e5e |
From d031facefbadc6c3f1ddb185c8e965cce68914e8 Mon Sep 17 00:00:00 2001
|
|
|
255e5e |
From: jmaloy <jmaloy@redhat.com>
|
|
|
255e5e |
Date: Thu, 14 May 2020 21:13:11 +0100
|
|
|
255e5e |
Subject: [PATCH 3/6] misc: use slirp_fmt0()
|
|
|
255e5e |
MIME-Version: 1.0
|
|
|
255e5e |
Content-Type: text/plain; charset=UTF-8
|
|
|
255e5e |
Content-Transfer-Encoding: 8bit
|
|
|
255e5e |
|
|
|
255e5e |
RH-Author: jmaloy <jmaloy@redhat.com>
|
|
|
255e5e |
Message-id: <20200514211314.1534001-4-jmaloy@redhat.com>
|
|
|
255e5e |
Patchwork-id: 96587
|
|
|
255e5e |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 3/6] misc: use slirp_fmt0()
|
|
|
255e5e |
Bugzilla: 1834477
|
|
|
255e5e |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
255e5e |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
255e5e |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
255e5e |
|
|
|
255e5e |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
255e5e |
|
|
|
255e5e |
Those are safe and should never fail. Nevertheless, use
|
|
|
255e5e |
slirp_snfillf0() for more safety.
|
|
|
255e5e |
|
|
|
255e5e |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
255e5e |
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
|
|
255e5e |
Message-Id: <20200127092414.169796-4-marcandre.lureau@redhat.com>
|
|
|
255e5e |
|
|
|
255e5e |
(cherry picked from libslirp commit 2af8a28a7ef0acde6f7525b346a3701d1cb54cd8)
|
|
|
255e5e |
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
255e5e |
|
|
|
255e5e |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
255e5e |
---
|
|
|
255e5e |
slirp/misc.c | 12 ++++++------
|
|
|
255e5e |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
255e5e |
|
|
|
255e5e |
diff --git a/slirp/misc.c b/slirp/misc.c
|
|
|
255e5e |
index 035b9ab..e256dbe 100644
|
|
|
255e5e |
--- a/slirp/misc.c
|
|
|
255e5e |
+++ b/slirp/misc.c
|
|
|
255e5e |
@@ -250,7 +250,7 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon)
|
|
|
255e5e |
dst_addr = so->so_faddr;
|
|
|
255e5e |
dst_port = so->so_fport;
|
|
|
255e5e |
}
|
|
|
255e5e |
- snprintf(buf, sizeof(buf), " TCP[%s]", state);
|
|
|
255e5e |
+ slirp_fmt0(buf, sizeof(buf), " TCP[%s]", state);
|
|
|
255e5e |
monitor_printf(mon, "%-19s %3d %15s %5d ", buf, so->s,
|
|
|
255e5e |
src.sin_addr.s_addr ? inet_ntoa(src.sin_addr) : "*",
|
|
|
255e5e |
ntohs(src.sin_port));
|
|
|
255e5e |
@@ -261,14 +261,14 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon)
|
|
|
255e5e |
|
|
|
255e5e |
for (so = slirp->udb.so_next; so != &slirp->udb; so = so->so_next) {
|
|
|
255e5e |
if (so->so_state & SS_HOSTFWD) {
|
|
|
255e5e |
- snprintf(buf, sizeof(buf), " UDP[HOST_FORWARD]");
|
|
|
255e5e |
+ slirp_fmt0(buf, sizeof(buf), " UDP[HOST_FORWARD]");
|
|
|
255e5e |
src_len = sizeof(src);
|
|
|
255e5e |
getsockname(so->s, (struct sockaddr *)&src, &src_len);
|
|
|
255e5e |
dst_addr = so->so_laddr;
|
|
|
255e5e |
dst_port = so->so_lport;
|
|
|
255e5e |
} else {
|
|
|
255e5e |
- snprintf(buf, sizeof(buf), " UDP[%d sec]",
|
|
|
255e5e |
- (so->so_expire - curtime) / 1000);
|
|
|
255e5e |
+ slirp_fmt0(buf, sizeof(buf), " UDP[%d sec]",
|
|
|
255e5e |
+ (so->so_expire - curtime) / 1000);
|
|
|
255e5e |
src.sin_addr = so->so_laddr;
|
|
|
255e5e |
src.sin_port = so->so_lport;
|
|
|
255e5e |
dst_addr = so->so_faddr;
|
|
|
255e5e |
@@ -283,8 +283,8 @@ void slirp_connection_info(Slirp *slirp, Monitor *mon)
|
|
|
255e5e |
}
|
|
|
255e5e |
|
|
|
255e5e |
for (so = slirp->icmp.so_next; so != &slirp->icmp; so = so->so_next) {
|
|
|
255e5e |
- snprintf(buf, sizeof(buf), " ICMP[%d sec]",
|
|
|
255e5e |
- (so->so_expire - curtime) / 1000);
|
|
|
255e5e |
+ slirp_fmt0(buf, sizeof(buf), " ICMP[%d sec]",
|
|
|
255e5e |
+ (so->so_expire - curtime) / 1000);
|
|
|
255e5e |
src.sin_addr = so->so_laddr;
|
|
|
255e5e |
dst_addr = so->so_faddr;
|
|
|
255e5e |
monitor_printf(mon, "%-19s %3d %15s - ", buf, so->s,
|
|
|
255e5e |
--
|
|
|
255e5e |
1.8.3.1
|
|
|
255e5e |
|