aboutsummaryrefslogtreecommitdiff
path: root/slirp/ip_icmp.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-22 02:06:41 +0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-01-14 23:36:38 +0100
commit226ea7a96485f2b9db13b523551c536dc68a1689 (patch)
treec2e90a49e934d31ca6e22678888e63c07785f856 /slirp/ip_icmp.c
parent2a2d3e4a258b9ed7ef5be7c6e421d58a365a0297 (diff)
downloadqemu-226ea7a96485f2b9db13b523551c536dc68a1689.zip
qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.gz
qemu-226ea7a96485f2b9db13b523551c536dc68a1689.tar.bz2
slirp: call into g_debug() for DEBUG macros
Make slirp use GLib logging, instead of fprintf(), so that applications can filter log, process it etc. With recent versions of glib, G_MESSAGES_DEBUG must be set to "all" or "Slirp" to see slirp debug messages. Reformat DEBUG_MISC & DEBUG_ERROR calls to not need \n ending. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'slirp/ip_icmp.c')
-rw-r--r--slirp/ip_icmp.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index cd2faea..7c7e042 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -103,7 +103,7 @@ static int icmp_send(struct socket *so, struct mbuf *m, int hlen)
if (sendto(so->s, m->m_data + hlen, m->m_len - hlen, 0,
(struct sockaddr *)&addr, sizeof(addr)) == -1) {
- DEBUG_MISC("icmp_input icmp sendto tx errno = %d-%s\n",
+ DEBUG_MISC("icmp_input icmp sendto tx errno = %d-%s",
errno, strerror(errno));
icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));
icmp_detach(so);
@@ -169,7 +169,7 @@ icmp_input(struct mbuf *m, int hlen)
return;
}
if (udp_attach(so, AF_INET) == -1) {
- DEBUG_MISC("icmp_input udp_attach errno = %d-%s\n",
+ DEBUG_MISC("icmp_input udp_attach errno = %d-%s",
errno,strerror(errno));
sofree(so);
m_free(m);
@@ -192,7 +192,7 @@ icmp_input(struct mbuf *m, int hlen)
if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0,
(struct sockaddr *)&addr, sockaddr_size(&addr)) == -1) {
- DEBUG_MISC("icmp_input udp sendto tx errno = %d-%s\n",
+ DEBUG_MISC("icmp_input udp sendto tx errno = %d-%s",
errno,strerror(errno));
icmp_send_error(m, ICMP_UNREACH, ICMP_UNREACH_NET, 0, strerror(errno));
udp_detach(so);
@@ -261,7 +261,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
char bufa[20], bufb[20];
strcpy(bufa, inet_ntoa(ip->ip_src));
strcpy(bufb, inet_ntoa(ip->ip_dst));
- DEBUG_MISC(" %.16s to %.16s\n", bufa, bufb);
+ DEBUG_MISC(" %.16s to %.16s", bufa, bufb);
}
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
@@ -458,7 +458,7 @@ void icmp_receive(struct socket *so)
} else {
error_code = ICMP_UNREACH_HOST;
}
- DEBUG_MISC(" udp icmp rx errno = %d-%s\n", errno,
+ DEBUG_MISC(" udp icmp rx errno = %d-%s", errno,
strerror(errno));
icmp_send_error(so->so_m, ICMP_UNREACH, error_code, 0, strerror(errno));
} else {