From owner-freebsd-emulation@FreeBSD.ORG Fri Jan 12 01:43:34 2007 Return-Path: X-Original-To: freebsd-emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD0D416A40F for ; Fri, 12 Jan 2007 01:43:34 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.freebsd.org (Postfix) with ESMTP id 898F113C459 for ; Fri, 12 Jan 2007 01:43:34 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: by gwyn.kn-bremen.de (Postfix, from userid 10) id D14091993E9; Fri, 12 Jan 2007 02:43:32 +0100 (CET) Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.13.6/8.13.6) with ESMTP id l0C1fie5050664; Fri, 12 Jan 2007 02:41:44 +0100 (CET) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.13.6/8.13.6/Submit) id l0C1fhiY050663; Fri, 12 Jan 2007 02:41:43 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Fri, 12 Jan 2007 02:41:43 +0100 To: qemu-devel@nongnu.org, freebsd-emulation@FreeBSD.org Message-ID: <20070112014143.GA50646@saturn.kn-bremen.de> Mail-Followup-To: qemu-devel@nongnu.org, freebsd-emulation@FreeBSD.org 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> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Subject: Re: weird slirp problems (dns lookups stopped working, and maybe more) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2007 01:43:34 -0000 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;