From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FatxT-0007Nv-6e for qemu-devel@nongnu.org; Tue, 02 May 2006 08:26:27 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FatxS-0007Nb-GL for qemu-devel@nongnu.org; Tue, 02 May 2006 08:26:26 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FatxS-0007NX-9E for qemu-devel@nongnu.org; Tue, 02 May 2006 08:26:26 -0400 Received: from [195.238.5.235] (helo=outmx008.isp.belgacom.be) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1Fatxb-0004DE-FN for qemu-devel@nongnu.org; Tue, 02 May 2006 08:26:35 -0400 Received: from outmx008.isp.belgacom.be (localhost [127.0.0.1]) by outmx008.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-OUT-2.22) with ESMTP id k42CQ4Pv029994 for ; Tue, 2 May 2006 14:26:09 +0200 (envelope-from ) Message-ID: <44574FCF.3080403@easynet.be> From: Mark Jonckheere MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000504030906010108030403" Subject: [Qemu-devel] [PATCH]: UDP-broadcast address-translation error in slirp code. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 02 May 2006 12:26:27 -0000 To: qemu-devel@nongnu.org, paul@nowt.org, fabrice@bellard.org This is a multi-part message in MIME format. --------------000504030906010108030403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Fabrice, Paul, There has been a lot of changes in the slirp code this last week, so I'll try once again to submit my UDP broadcast patch. Note, the patch has been modified from previous submissions: this time I do only a check for a broadcast address, when the address has been replaced with our special address. Description of the problem: guest host ----- ---- 10.0.2.15 --> 10.0.2.255 # guest sends broadcast packet 10.0.2.15 <-- 10.0.2.255 # host sends reply with invalid source # address, packet is ignored by guest This should be: guest host ----- ---- 10.0.2.15 --> 10.0.2.255 # guest sends broadcast packet 10.0.2.15 <-- 10.0.2.2 # host replies with his own address. Packets with destination address 10.0.2.255 (IP-broadcast) from the guest to the host are replied by the slirp code with this broadcast address as source address where it should be the host IP-address (CTL_ALIAS), since CTL_CMD and CLT_EXEC are not used and CTL_DNS is excluded because it doesn't make sense to do a broadcast DNS lookup. Correcting this bug makes it possible for e.g. a Windows 98 guest to browse the network neigbourhoud and see the share that is published by the host with the -smb switch. Greetings, Mark. --------------000504030906010108030403 Content-Type: text/x-patch; name="patches.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patches.diff" diff -wurb qemu/slirp/udp.c qemu-patched/slirp/udp.c --- qemu/slirp/udp.c 2005-07-03 19:08:43.000000000 +0200 +++ qemu-patched/slirp/udp.c 2006-05-02 12:19:22.000000000 +0200 @@ -312,8 +312,11 @@ struct sockaddr_in saddr, daddr; saddr = *addr; - if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) + if ((so->so_faddr.s_addr & htonl(0xffffff00)) == special_addr.s_addr) { saddr.sin_addr.s_addr = so->so_faddr.s_addr; + if ((so->so_faddr.s_addr & htonl(0x000000ff)) == htonl(0xff)) + saddr.sin_addr.s_addr = special_addr.s_addr | htonl(CTL_ALIAS); + } daddr.sin_addr = so->so_laddr; daddr.sin_port = so->so_lport; --------------000504030906010108030403--