From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Cizzg-0002KH-1f for qemu-devel@nongnu.org; Mon, 27 Dec 2004 13:53:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Cizze-0002J3-Gg for qemu-devel@nongnu.org; Mon, 27 Dec 2004 13:53:23 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cizzd-0002Il-GZ for qemu-devel@nongnu.org; Mon, 27 Dec 2004 13:53:21 -0500 Received: from [199.232.41.5] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CizoR-0001zU-JP for qemu-devel@nongnu.org; Mon, 27 Dec 2004 13:41:47 -0500 Received: from [213.228.0.44] (helo=postfix3-1.free.fr) by mx20.gnu.org with esmtp (Exim 4.34) id 1CizQZ-00037w-OD for qemu-devel@nongnu.org; Mon, 27 Dec 2004 13:17:07 -0500 Received: from [192.168.1.30] (rkeller-2-81-57-247-13.fbx.proxad.net [81.57.247.13]) by postfix3-1.free.fr (Postfix) with ESMTP id 0A2C71734A6 for ; Mon, 27 Dec 2004 19:17:05 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v619) Message-Id: <5D98DB16-5824-11D9-B8FF-00039307264A@cs.stanford.edu> Content-Type: multipart/mixed; boundary=Apple-Mail-1--843815521 From: Laurent Amon Date: Mon, 27 Dec 2004 17:28:39 +0100 Subject: [Qemu-devel] patch for smb/user-net with no network 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 --Apple-Mail-1--843815521 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Hi, On OSX, I use user-net and qemu does not start when I am not connected to the network unless you do specify -nics 0. It exits when it does not find a DNS. However, I use my SAMBA service to mount host partitions, so I would like to have the network start. This patch sets the DNS to the local address when none is found so I can still use the net when host is not on the network. Rgds, --Apple-Mail-1--843815521 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="nodns.diff" Content-Disposition: attachment; filename=nodns.diff *** qemu-snapshot-2004-12-22_23/slirp/slirp.c Fri Oct 8 01:27:35 2004 --- qemu-snapshot-2004-12-22_23-patched/slirp/slirp.c Mon Dec 27 17:18:29 2004 *************** *** 86,94 **** struct in_addr tmp_addr; f = fopen("/etc/resolv.conf", "r"); ! if (!f) ! return -1; ! lprint("IP address of your DNS(s): "); while (fgets(buff, 512, f) != NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { --- 86,96 ---- struct in_addr tmp_addr; f = fopen("/etc/resolv.conf", "r"); ! if (!f){ ! //return -1; ! tmp_addr = our_addr; ! *pdns_addr = tmp_addr; ! }else{ lprint("IP address of your DNS(s): "); while (fgets(buff, 512, f) != NULL) { if (sscanf(buff, "nameserver%*[ \t]%256s", buff2) == 1) { *************** *** 109,116 **** } } fclose(f); ! if (!found) ! return -1; return 0; } --- 111,122 ---- } } fclose(f); ! } ! if (!found){ ! //return -1; ! tmp_addr = our_addr; ! *pdns_addr = tmp_addr; ! } return 0; } --Apple-Mail-1--843815521 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Lga. --Apple-Mail-1--843815521--