aboutsummaryrefslogtreecommitdiff
path: root/slirp/ip_icmp.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2012-02-08 10:05:45 +0100
committerJan Kiszka <jan.kiszka@siemens.com>2012-02-08 10:07:54 +0100
commit6612db12d56c68fff3e56ca4ea8c41d9d55c12e4 (patch)
tree7f3ac2fd1fedb13094d6d61d3b20fa2709143951 /slirp/ip_icmp.c
parent9f1134d4aac64ea427453fc7c7f8cab39f4fe3da (diff)
downloadqemu-6612db12d56c68fff3e56ca4ea8c41d9d55c12e4.zip
qemu-6612db12d56c68fff3e56ca4ea8c41d9d55c12e4.tar.gz
qemu-6612db12d56c68fff3e56ca4ea8c41d9d55c12e4.tar.bz2
slirp: Prevent sending ICMP error replies to source-only addresses
This triggered the related assert in arp_table_search. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'slirp/ip_icmp.c')
-rw-r--r--slirp/ip_icmp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/slirp/ip_icmp.c b/slirp/ip_icmp.c
index 4b43994..5dbf21d 100644
--- a/slirp/ip_icmp.c
+++ b/slirp/ip_icmp.c
@@ -262,6 +262,11 @@ icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
#endif
if(ip->ip_off & IP_OFFMASK) goto end_error; /* Only reply to fragment 0 */
+ /* Do not reply to source-only IPs */
+ if ((ip->ip_src.s_addr & htonl(~(0xf << 28))) == 0) {
+ goto end_error;
+ }
+
shlen=ip->ip_hl << 2;
s_ip_len=ip->ip_len;
if(ip->ip_p == IPPROTO_ICMP) {