summaryrefslogtreecommitdiffstats
path: root/slirp/ip_icmp.c
diff options
context:
space:
mode:
authorPeter Maydell2019-01-15 19:32:57 +0100
committerPeter Maydell2019-01-15 19:32:57 +0100
commit6f2f34177a25bffd6fd92a05e6e66c8d22d97094 (patch)
tree1882acc43647e724d01c6b6057b1fc7bad70d47a /slirp/ip_icmp.c
parentMerge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ... (diff)
parentslirp: check data length while emulating ident function (diff)
downloadqemu-6f2f34177a25bffd6fd92a05e6e66c8d22d97094.tar.gz
qemu-6f2f34177a25bffd6fd92a05e6e66c8d22d97094.tar.xz
qemu-6f2f34177a25bffd6fd92a05e6e66c8d22d97094.zip
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
slirp updates Gerd Hoffmann (1): slirp: add tftp tracing Marc-André Lureau (61): slirp: associate slirp_output callback with the Slirp context slirp: remove do_pty from fork_exec() slirp: replace ex_pty with ex_chardev slirp: use a dedicated field for chardev pointer slirp: remove unused EMU_RSH slirp: rename /extra/chardev slirp: move internal function declarations slirp: remove Monitor dependency, return a string for info slirp: fix slirp_add_exec() leaks slirp: replace the poor-man string split with g_strsplit() slirp: remove dead declarations slirp: move socket pair creation in helper function slirp: remove unused M_TRAILINGSPACE slirp: use a callback structure to interface with qemu slirp: remove PROBE_CONN dead-code slirp: remove FULL_BOLT slirp: remove the disabled readv()/writev() code path slirp: remove HAVE_SYS_SIGNAL_H slirp: remove unused HAVE_SYS_BITYPES_H slirp: remove NO_UNIX_SOCKETS slirp: remove unused HAVE_SYS_STROPTS_H slirp: remove unused HAVE_ARPA_INET_H slirp: remove unused HAVE_SYS_WAIT_H slirp: remove unused HAVE_SYS_SELECT_H slirp: remove HAVE_SYS_IOCTL_H slirp: remove HAVE_SYS_FILIO_H slirp: remove unused DECLARE_IOVEC slirp: remove unused HAVE_INET_ATON slirp: replace HOST_WORDS_BIGENDIAN with glib equivalent slirp: replace SIZEOF_CHAR_P with glib equivalent slirp: replace compile time DO_KEEPALIVE slirp: remove unused global slirp_instance slirp: replace error_report() with g_critical() slirp: improve a bit the debug macros slirp: add a callback to log guest errors slirp: remove #if notdef dead code slirp: remove unused sbflush() slirp: NULL is defined by stddef.h slirp: remove dead TCP_ACK_HACK code slirp: replace ARRAY_SIZE with G_N_ELEMENTS net: do not depend on slirp internals glib-compat: add g_spawn_async_with_fds() fallback slirp: simplify fork_exec() slirp: replace error_report() with g_critical() slirp: drop <Vista compatibility slirp: rename exec_list slirp: use virtual time for packet expiration slirp: replace a fprintf with g_critical() slirp: replace some fprintf() with DEBUG_MISC slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG slirp: no need to make DPRINTF conditional on DEBUG slirp: always build with debug statements slirp: introduce SLIRP_DEBUG environment variable slirp: use %p for pointers format slirp: remove remaining DEBUG blocks slirp: replace DEBUG_ARGS with DEBUG_ARG slirp: factor out guestfwd addition checks slirp: add clock_get_ns() callback build-sys: use a separate slirp-obj-y && slirp.mo slirp: set G_LOG_DOMAIN slirp: call into g_debug() for DEBUG macros Prasad J Pandit (1): slirp: check data length while emulating ident function Samuel Thibault (2): slirp: Enable fork_exec support on Windows slirp: Mark debugging calls as unlikely Makefile | 5 +- Makefile.objs | 4 +- Makefile.target | 5 +- include/glib-compat.h | 56 +++++++++ net/colo-compare.c | 11 +- net/colo.c | 1 + net/colo.h | 7 +- net/filter-rewriter.c | 9 +- net/slirp.c | 61 +++++---- net/util.h | 55 ++++++++ slirp/Makefile.objs | 37 +++++- slirp/arp_table.c | 12 +- slirp/bootp.c | 10 +- slirp/cksum.c | 8 +- slirp/debug.h | 47 ++++--- slirp/dhcpv6.c | 17 ++- slirp/if.c | 4 +- slirp/ip.h | 10 +- slirp/ip6.h | 3 +- slirp/ip6_icmp.c | 27 ++-- slirp/ip6_icmp.h | 6 +- slirp/ip6_input.c | 2 +- slirp/ip6_output.c | 4 +- slirp/ip_icmp.c | 31 ++--- slirp/ip_input.c | 200 ----------------------------- slirp/libslirp.h | 27 ++-- slirp/main.h | 33 ----- slirp/mbuf.c | 2 +- slirp/mbuf.h | 1 - slirp/misc.c | 286 +++++++++++++++++------------------------- slirp/misc.h | 13 +- slirp/ncsi.c | 4 +- slirp/ndp_table.c | 32 +++-- slirp/sbuf.h | 1 - slirp/slirp.c | 177 +++++++++++++------------- slirp/slirp.h | 45 ++----- slirp/slirp_config.h | 86 ------------- slirp/socket.c | 53 +++----- slirp/socket.h | 2 +- slirp/tcp.h | 4 +- slirp/tcp_input.c | 84 ++----------- slirp/tcp_output.c | 2 +- slirp/tcp_subr.c | 22 ++-- slirp/tcp_timer.c | 2 +- slirp/tftp.c | 7 +- slirp/trace-events | 5 + slirp/udp.c | 5 +- slirp/udp6.c | 11 +- stubs/slirp.c | 2 +- 49 files changed, 603 insertions(+), 935 deletions(-) delete mode 100644 slirp/slirp_config.h create mode 100644 slirp/trace-events -- 2.20.1 # gpg: Signature made Mon 14 Jan 2019 22:52:32 GMT # gpg: using RSA key DB550E89F0FA54F3 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" # gpg: aka "Samuel Thibault <sthibault@debian.org>" # gpg: aka "Samuel Thibault <samuel.thibault@gnu.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: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" # 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: E61D BB15 D417 2BDE C97E 92D9 DB55 0E89 F0FA 54F3 * remotes/thibault/tags/samuel-thibault: (65 commits) slirp: check data length while emulating ident function slirp: Mark debugging calls as unlikely slirp: call into g_debug() for DEBUG macros slirp: set G_LOG_DOMAIN build-sys: use a separate slirp-obj-y && slirp.mo slirp: add clock_get_ns() callback slirp: factor out guestfwd addition checks slirp: replace DEBUG_ARGS with DEBUG_ARG slirp: remove remaining DEBUG blocks slirp: use %p for pointers format slirp: introduce SLIRP_DEBUG environment variable slirp: always build with debug statements slirp: no need to make DPRINTF conditional on DEBUG slirp: replace a DEBUG block with WITH_ICMP_ERROR_MSG slirp: replace some fprintf() with DEBUG_MISC slirp: replace a fprintf with g_critical() slirp: use virtual time for packet expiration slirp: rename exec_list slirp: drop <Vista compatibility slirp: Enable fork_exec support on Windows ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'slirp/ip_icmp.c')
-rw-r--r--slirp/ip_icmp.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 9210eef3f3..7c7e042049 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -34,6 +34,10 @@
#include "slirp.h"
#include "ip_icmp.h"
+#ifndef WITH_ICMP_ERROR_MSG
+#define WITH_ICMP_ERROR_MSG 0
+#endif
+
/* The message sent when emulating PING */
/* Be nice and tell them it's just a pseudo-ping packet */
static const char icmp_ping_msg[] = "This is a pseudo-PING packet used by Slirp to emulate ICMP ECHO-REQUEST packets.\n";
@@ -99,8 +103,8 @@ 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((dfd, "icmp_input icmp sendto tx errno = %d-%s\n",
- errno, strerror(errno)));
+ 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);
}
@@ -165,8 +169,8 @@ icmp_input(struct mbuf *m, int hlen)
return;
}
if (udp_attach(so, AF_INET) == -1) {
- DEBUG_MISC((dfd,"icmp_input udp_attach errno = %d-%s\n",
- errno,strerror(errno)));
+ DEBUG_MISC("icmp_input udp_attach errno = %d-%s",
+ errno,strerror(errno));
sofree(so);
m_free(m);
goto end_error;
@@ -188,8 +192,8 @@ 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((dfd,"icmp_input udp sendto tx errno = %d-%s\n",
- errno,strerror(errno)));
+ 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);
}
@@ -253,13 +257,12 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
/* check msrc */
if(!msrc) goto end_error;
ip = mtod(msrc, struct ip *);
-#ifdef DEBUG
- { char bufa[20], bufb[20];
+ if (slirp_debug & DBG_MISC) {
+ char bufa[20], bufb[20];
strcpy(bufa, inet_ntoa(ip->ip_src));
strcpy(bufb, inet_ntoa(ip->ip_dst));
- DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb));
+ DEBUG_MISC(" %.16s to %.16s", bufa, bufb);
}
-#endif
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
/* Do not reply to source-only IPs */
@@ -319,8 +322,7 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
HTONS(icp->icmp_ip.ip_id);
HTONS(icp->icmp_ip.ip_off);
-#ifdef DEBUG
- if(message) { /* DEBUG : append message to ICMP packet */
+ if (message && WITH_ICMP_ERROR_MSG) { /* append message to ICMP packet */
int message_len;
char *cpnt;
message_len=strlen(message);
@@ -329,7 +331,6 @@ icmp_send_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
memcpy(cpnt, message, message_len);
m->m_len+=message_len;
}
-#endif
icp->icmp_cksum = 0;
icp->icmp_cksum = cksum(m, m->m_len);
@@ -457,8 +458,8 @@ void icmp_receive(struct socket *so)
} else {
error_code = ICMP_UNREACH_HOST;
}
- DEBUG_MISC((dfd, " udp icmp rx errno = %d-%s\n", errno,
- strerror(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 {
icmp_reflect(so->so_m);