From patchwork Mon Dec 3 22:08:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 203452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D70502C00A7 for ; Tue, 4 Dec 2012 09:15:19 +1100 (EST) Received: from localhost ([::1]:43839 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeIH-0005wP-UI for incoming@patchwork.ozlabs.org; Mon, 03 Dec 2012 17:15:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeI8-0005v8-Jx for qemu-devel@nongnu.org; Mon, 03 Dec 2012 17:15:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfeI6-0002sJ-Ve for qemu-devel@nongnu.org; Mon, 03 Dec 2012 17:15:08 -0500 Received: from mail-ia0-f173.google.com ([209.85.210.173]:49594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfeI4-0002mU-P6; Mon, 03 Dec 2012 17:15:04 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so2526528iac.4 for ; Mon, 03 Dec 2012 14:15:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=aRimiExHmUHxwBlaZAzAa+Gz/Ktlt+GDEDMuO2zxCHU=; b=spZPQXDq6ULBDfX6s0vAKDNVPKZKkrKT5bxzHVYHTi80qtEGzjQqCPhrABP4NOXMre J1CV+lxQm/luKwEBikcbCfWxHRrNsxW+lEFQGvOMBDQegQkhItnqRKA7ldOtvUbnICdw 4noNu5VPySazBr5c5v2ye9vsnzfPWFq+n1zKQ/ue4MYpbEW03rTLMbHIXqa5BO3mhZXx 9b6KsK14L+wZD1yjwekMMoP/+bGsXb7JPOI14c/MveH67tMTmW0WI9kWuCquj+iHmWO1 70eDwXhnSghOnp7w/dyry8zCazWoAup83j53i3UvjKih5CslqgjGasu0BSjNNZHLR6He wiZA== Received: by 10.50.0.168 with SMTP id 8mr591400igf.36.1354572904231; Mon, 03 Dec 2012 14:15:04 -0800 (PST) Received: from localhost ([32.97.110.59]) by mx.google.com with ESMTPS id uj11sm8106360igb.15.2012.12.03.14.15.03 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 03 Dec 2012 14:15:03 -0800 (PST) From: Michael Roth To: qemu-stable@nongnu.org Date: Mon, 3 Dec 2012 16:08:28 -0600 Message-Id: <1354572547-21271-5-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354572547-21271-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1354572547-21271-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.210.173 Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 04/43] vnc: fix "info vnc" with "-vnc ..., reverse=on" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini When reverse connection is in use, there is no active VNC server socket. Because of this, getsockopt(-1, ...) is attempted and the following error is emitted: $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr & $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc An undefined error has occurred Because however the host, family, service and auth fields are optional, we can just exit if there is no active server socket. $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc Server: Client: address: 127.0.0.1:5900 x509_dname: none username: none Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi (cherry picked from commit 417b0b88904fe1dd8c41bff8092dfbab0134d9cb) Signed-off-by: Michael Roth --- ui/vnc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index 18ec101..66ae930 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -372,6 +372,10 @@ VncInfo *qmp_query_vnc(Error **errp) } } + if (vnc_display->lsock == -1) { + return info; + } + if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa, &salen) == -1) { error_set(errp, QERR_UNDEFINED_ERROR);