From patchwork Thu Feb 10 09:16:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 82574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AA97AB70B3 for ; Thu, 10 Feb 2011 20:19:00 +1100 (EST) Received: from localhost ([127.0.0.1]:36121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnSg1-0006ml-3i for incoming@patchwork.ozlabs.org; Thu, 10 Feb 2011 04:19:01 -0500 Received: from [140.186.70.92] (port=43437 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnSfU-0006mc-68 for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:18:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnSfO-00075X-8q for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:18:23 -0500 Received: from smtp.ispras.ru ([83.149.198.201]:41480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnSfO-00071A-2R for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:18:22 -0500 Received: from PASHAISP (ispserv.ispras.ru [83.149.198.72]) by smtp.ispras.ru (Postfix) with ESMTP id C6FFD5D4104 for ; Thu, 10 Feb 2011 12:07:54 +0300 (MSK) From: "Pavel Dovgaluk" To: Date: Thu, 10 Feb 2011 12:16:09 +0300 Message-ID: <001b01cbc903$27cfdd50$776f97f0$@Dovgaluk@ispras.ru> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcvJAyectXl98bbpSVKcWovn4zl17g== Content-Language: ru X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 83.149.198.201 Subject: [Qemu-devel] [PATCH] Network functions patches for win32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch contains some fixes for network functions, working in Windows environment, and consists of two parts: 1. net/socket.c fix MSDN includes the following in WSAEALREADY error description for connect() function: "To preserve backward compatibility, this error is reported as WSAEINVAL to Winsock applications that link to either Winsock.dll or Wsock32.dll". So check of this error code was added to allow network connections through the sockets in Windows. 2. net/tap-win32.c fix This fix allows connection of internal VLAN to the external TAP interface. If tap_win32_write function always returns 0, the TAP network interface in QEMU is disabled. Signed-off-by: Pavel Dovgalyuk --- net/socket.c | 2 +- net/tap-win32.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index 3182b37..7337f4f 100644 --- a/net/socket.c +++ b/net/socket.c @@ -457,7 +457,7 @@ static int net_socket_connect_init(VLANState *vlan, } else if (err == EINPROGRESS) { break; #ifdef _WIN32 - } else if (err == WSAEALREADY) { + } else if (err == WSAEALREADY || err == WSAEINVAL) { break; #endif } else { diff --git a/net/tap-win32.c b/net/tap-win32.c index 081904e..596132e 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -480,7 +480,7 @@ static int tap_win32_write(tap_win32_overlapped_t *overlapped, } } - return 0; + return write_size; } static DWORD WINAPI tap_win32_thread_entry(LPVOID param)