Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H5BSD-0000nI-FL for qemu-devel@nongnu.org; Thu, 11 Jan 2007 20:43:37 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H5BSB-0000m3-Nr for qemu-devel@nongnu.org; Thu, 11 Jan 2007 20:43:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H5BSB-0000ls-Js for qemu-devel@nongnu.org; Thu, 11 Jan 2007 20:43:35 -0500 Received: from [212.63.36.242] (helo=gwyn.kn-bremen.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H5BSA-00044L-Vh for qemu-devel@nongnu.org; Thu, 11 Jan 2007 20:43:35 -0500 From: Juergen Lock Date: Fri, 12 Jan 2007 02:41:43 +0100 Message-ID: <20070112014143.GA50646@saturn.kn-bremen.de> References: <20070109204740.GA98620@saturn.kn-bremen.de> <20070109230403.GA4552@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070109230403.GA4552@saturn.kn-bremen.de> Subject: [Qemu-devel] Re: weird slirp problems (dns lookups stopped working, and maybe more) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, freebsd-emulation@FreeBSD.org On Wed, Jan 10, 2007 at 12:04:03AM +0100, Juergen Lock wrote: >... > Ok, garrison on irc just helped solve this mystery: This (the same) > one actually goes out first, before the 10.0.2.3 one (I didn't notice > at first), and since slirp reuses the socket because the source ip and > port hasnt changed (slirp/udp.c lines 172 and up, it doesn't check the > dest ip), the second packet with the 10.0.2.3 dest ip (which gets > replaced with the hosts's dns) goes out wrong. And the reason this > worked previously with the same guest is multicast started working > only recently... And here's the fix I just added to the FreeBSD qemu port: (thanx garrison!) Index: qemu/slirp/udp.c @@ -205,8 +208,6 @@ /* udp_last_so = so; */ so->so_laddr = ip->ip_src; so->so_lport = uh->uh_sport; - so->so_faddr = ip->ip_dst; /* XXX */ - so->so_fport = uh->uh_dport; /* XXX */ if ((so->so_iptos = udp_tos(so)) == 0) so->so_iptos = ip->ip_tos; @@ -216,6 +217,15 @@ * and if it is, do the fork_exec() etc. */ } + + /* + * Assign destination unconditionally + * + * This fixes the case where packets are sent from the same + * source ip/port to different destination ips/ports + */ + so->so_faddr = ip->ip_dst; /* XXX */ + so->so_fport = uh->uh_dport; /* XXX */ iphlen += sizeof(struct udphdr); m->m_len -= iphlen;