From patchwork Mon Dec 20 15:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12688371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0B1CC433EF for ; Mon, 20 Dec 2021 18:21:17 +0000 (UTC) Received: from localhost ([::1]:47438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzNHg-00040k-6g for qemu-devel@archiver.kernel.org; Mon, 20 Dec 2021 13:21:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKq9-0001Al-Cq for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:44:41 -0500 Received: from mail-vi1eur05on2121.outbound.protection.outlook.com ([40.107.21.121]:27986 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKq6-0001WG-Es for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:44:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XYmxnEUEmaA/kZA9AV5cEs/BpAf0Lfpr/h3dcbx4rpl9zmMMCd7PzGqLBx1ThvdEGjMXSmhOv+dIK9TXMAx/UJGSf8vFP+4U4F38qSZ9GWE7W3+43QFJEgmWbA5WROlj6c0uYIoxkIHcWIfqqoVnaCQOndyL3DBaXBz3EEoLxJkNje1sdZaZu3iTAC4NOS7PXMdvILEDOqsZbaF6+VkdO9alDFK05Rl66ILuMAnc3YNjRXo1IOijo324eXbu7/H6cLVos/39jH+0mjo0rUKSF+xhr3jiOh1VlOlP6AnsAFLmgmK8s396fW/CJUaf6nftU2UagfMOepP7ctblJLy73Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1CnMI/aAArmnUy93C0hZ3gATFrSJ5S9T3MzV/dzejy4=; b=hTINrKf87B5X4KqkYhv1cWL7MesxpUDX4/c+AleF4GemEkDuC8D9xh8+UyGQ9ZM+zHeuWF/fDj9P6DIERFpxBhGmbYlbUjoMfR7gDf9kAp7zP2pfwisSygCkkCBdR4cwxtNsRwIcuQTvPeNfS99aon6IvFvDhKWiQ87jz+zzYjZrH8O0vH224BCFp3/eRnX9YVDG/kC7ugeSbVPb3X8MrwDjftSYf8RXbbJkG+KB/uwDqJfAPuQ8bxbqdq3t+IozP9xgoZrEqTkvwGlTEt3Rir9SjwmZzUYS9hbyEojvFPyUjcQjjB/h5to+DTyGt74w2l0Uzkwk3f48+B4qEsbjYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1CnMI/aAArmnUy93C0hZ3gATFrSJ5S9T3MzV/dzejy4=; b=BHrd+x4Dgi0KieFxGv2gc1d6x5qqF5XzjheFK60FshWZIfC8vv1AS3PhM5dLZj3QGRytFww8poh7yiXp9N7seuFI7/ZFrbp72AE8WLTjVmEvz4rOGrtEFrkYPjnJxFwqgvv/Fbgd0SnaHCafeOBHwxJyGFFqHaVpkx6yFEFIQCU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) by DB9PR08MB6667.eurprd08.prod.outlook.com (2603:10a6:10:2af::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.15; Mon, 20 Dec 2021 15:44:28 +0000 Received: from DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550]) by DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550%4]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 15:44:28 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, armbru@redhat.com, eblake@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 1/2] ui/vnc: refactor arrays of addresses to SocketAddressList Date: Mon, 20 Dec 2021 16:44:17 +0100 Message-Id: <20211220154418.1554279-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211220154418.1554279-1-vsementsov@virtuozzo.com> References: <20211220154418.1554279-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM6PR0202CA0055.eurprd02.prod.outlook.com (2603:10a6:20b:3a::32) To DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ad09b9e-9688-44cc-3203-08d9c3cf9b59 X-MS-TrafficTypeDiagnostic: DB9PR08MB6667:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:454; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TRB9hDrqz6S+C4fDoE+XaxwhX3rMtgAvaBrqNkdYvgcZx6o2KT+h7vN9sFZ1NOpCduQNodV1T0b8AgJOvswdl1N9o8SxkJOf2HApvWoHiihnrpEAHE008eADSi6EdUfaQ4hHAOiVGAYmbzfY3rEMlkCEPhGEqD/zHZSl4qjYJZpIA3vz0Z/5vbCP3ECEOXDhadGVLLQLGQ0tJRHlUx9l1ag1ZmtxhVg+In+3+pCbeWu7Idj2dpFcX3hjprzDbPrespJUYPiS6k0/4QT59o2wrckKFOngay64aJuui/42Lw+032yqnferRntacZ95fIH8llV1DAOJ6IK4fuOfD0roKNIikHwl+3AwWdjOCQ0xSgd+a4MZGatmc1vaVeSc0racj7ZAMOCRQe/mJoVbgHmWatxn69FgE2AwA+1LE7coSl4ZTkC6NYDhZnoqinM3+dDhfSQVwY2wZqDgEFWCRyuJ6Su4QMfRjH5DhbAZjc09wbi4H0iLdKVZA6wkLp3sqXGvl+CEgFgHJzQM224FNiRncFXaOCcj+k0rZ1FAOYVJyURIkgFAyrw8n8LY+Kcfm6P2XNYaA2k7hWIataJbK1gCBrbSHPseWDoVkoIzMmaYFsNB/aEJtq6Ho9AqumrSrROrCdajMX2irv3o6ZU5exuiK0mroVDXCM7aERELGbyU9R0kPsV6RHBDfBZVDuMG9TskChONamd75d40qOpbEbOvzg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB6748.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66556008)(66476007)(6512007)(316002)(6486002)(4326008)(8936002)(2906002)(8676002)(66946007)(26005)(38100700002)(38350700002)(508600001)(52116002)(2616005)(5660300002)(6916009)(86362001)(1076003)(6506007)(83380400001)(107886003)(6666004)(36756003)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mgh1IUcUPQDl/yf2OeDvwX86+SO91QAjmChEHj1+QvNkzBNQTRambisN9REbkDKcoZ5vRe1S883wutJ4dT1mP4nOcBA+bJJ6VxhjWnxWQvAaLZM8J8i/haT58Kb9MKE/u9fqbqnnEeN56mUWNaxJQY4/sep3Y3S3zuH+kgYuQejru2F8L9ZINeCGOyLKkAXOfS8MdisrYq07kh/s8dHGWPi8MiwPj1Ph5kTDUmpX4HAsc5Fro+Q7l8eFG0vi+Memp41YapE2vjhDg9EErbORDRt/BPKcouXH0l/200kjAoQN3rSSSU2DD/TmrP9U7kYiX+KBLCULIaLkXoWyyJXXBBpSKU+hsk4Flt6ryDXQBJQAw79qwzLHy2tv/ujfkzlpHod2ZSpF0FIPAb0M8df9pYOQ//bF6qPUQR+D/wj34iwMqN+kyLsEhSEL0pw19Le39+9b65+GWb8+PDVnSri99GgZ+8PJKokC1yeJyrWQr3z0CZzr0gabdG98DH9sEbWSf957BglCogwJ8d3E8R9uqePv3VCsZZL73PsZ7M7Ho2gFWRJ4adw/aNLEEAU6xrbdqox8ntOig4XI0+MFswF3DlY57SWVpeuM0z76jyk5OMz1TjIyaJlOC9vMgsyzRcALeFeNtkOxGWxgmcnSPOypVA9s6iLVV4f/THw8iqBBpnqEHo+VI3XmoGuMiHhDvHHLdchaEqWu5y0/+LDWLkW0EwORCz0ohxYT8glcDeWU73kWzBJvLaQEiBPt631++clBP10SpnVMANZ967CQoAV3wo7EcQK508Qz3a1ldQPY3IP9SiVbxGYfV1P1ixM6bJbaUvS3CqjO1aaopxGvdrQ4BD1BrPhSBrn7RkI38wXHo1KHUr+EJoJ2MdKWg25mkIq+uiyhhtLFPDhL3y7fk8Eri1oBOi0xfjgPzPJ9Dq1kLUvl3uKz2NLKpWqbPn51q7/aPvs4O+bJbTj4SYvHoIIoGRgMGXIiqbyCzvDC5JrXDHnbAeTTCleyZmJA7AlQg40T7a5kIyhqAzZ6ppTiTXyrAdSGVZ0jCA6X32z/JB4rSbBeTihT7CKvlsppuVFTaluhyAZEuFhej4Mc7DJo3piuCypGCVh05iXSEj80qQErC9UAxNnXdSd6ZNDQGluQP6eoYImxegavxfmpEEKsvq1w3QQqO1EXeGopM3YViNYSibkoNNXlT3VV9FqzOcTY19GooK6Calgo3jQKAKn3BE2odXha3oDGZGR6aU3Uwol/5RfKk77bPsfTNhtnwwuHl+9IS59ilpx00QQI2lZokArCPYMgbyNozlF+4pNDvBn3pWQSHRiutiu0pW7K9dlzqXkLhVgV7drDYo6RrHYaplLPgqyENoD1jPXYpur6erfuT/aGq2eB+xCW8tTziSzHQ5MSZ0otOT7OB7c4lELsk0UN4PIOUdNIY0a7C9x96aYUknzcjArH6XG2sr3JT0p96P7BWWVUJ5SgYujhA47M4gpJQpP5A7ClqS2IXYh4q+1CoOrsMdCytwPHFgdgOfkxAbh+rpgNGp7dR1c0uTLnoHLohLbPuzGc18d4mPMd/ciDSlDJ7c6RE4TaAspYdSGJnC+NESL9TGqkiLOOdyGSuOAhOveeWTpx7XY9hpqP5mzWAGSRdFyw74659mnNYA4lYbCDea4/sWg3/TyyotBfZQdPd4KK11iFXDOjjfFw3/G6L5g= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ad09b9e-9688-44cc-3203-08d9c3cf9b59 X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6748.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 15:44:28.5970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eYusfkcCrSgvQsM8PooimpeVFVQRIsDghPMmYUUBYQyK5tmkbc4Xbr8Us1DQczhx4jp2dX0CUNKRg7Y0qJ49ZW7vgNXMZcBAZMYUE5wNpSM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6667 Received-SPF: pass client-ip=40.107.21.121; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Let's use SocketAddressList instead of dynamic arrays. Benefits: - Automatic cleanup: don't need specific freeing function and drop some gotos. - Less indirection: no triple asterix anymore! - Prepare for the following commit, which will reuse new interface of vnc_display_listen(). Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Marc-André Lureau --- ui/vnc.c | 129 ++++++++++++++++++++++--------------------------------- 1 file changed, 51 insertions(+), 78 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index af02522e84..c9e26c70df 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3812,30 +3812,19 @@ static int vnc_display_get_address(const char *addrstr, return ret; } -static void vnc_free_addresses(SocketAddress ***retsaddr, - size_t *retnsaddr) -{ - size_t i; - - for (i = 0; i < *retnsaddr; i++) { - qapi_free_SocketAddress((*retsaddr)[i]); - } - g_free(*retsaddr); - - *retsaddr = NULL; - *retnsaddr = 0; -} - static int vnc_display_get_addresses(QemuOpts *opts, bool reverse, - SocketAddress ***retsaddr, - size_t *retnsaddr, - SocketAddress ***retwsaddr, - size_t *retnwsaddr, + SocketAddressList **saddr_list_ret, + SocketAddressList **wsaddr_list_ret, Error **errp) { SocketAddress *saddr = NULL; SocketAddress *wsaddr = NULL; + g_autoptr(SocketAddressList) saddr_list = NULL; + SocketAddressList **saddr_tail = &saddr_list; + SocketAddress *single_saddr = NULL; + g_autoptr(SocketAddressList) wsaddr_list = NULL; + SocketAddressList **wsaddr_tail = &wsaddr_list; QemuOptsIter addriter; const char *addr; int to = qemu_opt_get_number(opts, "to", 0); @@ -3844,23 +3833,16 @@ static int vnc_display_get_addresses(QemuOpts *opts, bool ipv4 = qemu_opt_get_bool(opts, "ipv4", false); bool ipv6 = qemu_opt_get_bool(opts, "ipv6", false); int displaynum = -1; - int ret = -1; - - *retsaddr = NULL; - *retnsaddr = 0; - *retwsaddr = NULL; - *retnwsaddr = 0; addr = qemu_opt_get(opts, "vnc"); if (addr == NULL || g_str_equal(addr, "none")) { - ret = 0; - goto cleanup; + return 0; } if (qemu_opt_get(opts, "websocket") && !qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) { error_setg(errp, "SHA1 hash support is required for websockets"); - goto cleanup; + return -1; } qemu_opt_iter_init(&addriter, opts, "vnc"); @@ -3871,7 +3853,7 @@ static int vnc_display_get_addresses(QemuOpts *opts, ipv4, ipv6, &saddr, errp); if (rv < 0) { - goto cleanup; + return -1; } /* Historical compat - first listen address can be used * to set the default websocket port @@ -3879,13 +3861,16 @@ static int vnc_display_get_addresses(QemuOpts *opts, if (displaynum == -1) { displaynum = rv; } - *retsaddr = g_renew(SocketAddress *, *retsaddr, *retnsaddr + 1); - (*retsaddr)[(*retnsaddr)++] = saddr; + QAPI_LIST_APPEND(saddr_tail, saddr); } - /* If we had multiple primary displays, we don't do defaults - * for websocket, and require explicit config instead. */ - if (*retnsaddr > 1) { + if (saddr_list && !saddr_list->next) { + single_saddr = saddr_list->value; + } else { + /* + * If we had multiple primary displays, we don't do defaults + * for websocket, and require explicit config instead. + */ displaynum = -1; } @@ -3895,57 +3880,50 @@ static int vnc_display_get_addresses(QemuOpts *opts, has_ipv4, has_ipv6, ipv4, ipv6, &wsaddr, errp) < 0) { - goto cleanup; + return -1; } /* Historical compat - if only a single listen address was * provided, then this is used to set the default listen * address for websocket too */ - if (*retnsaddr == 1 && - (*retsaddr)[0]->type == SOCKET_ADDRESS_TYPE_INET && + if (single_saddr && + single_saddr->type == SOCKET_ADDRESS_TYPE_INET && wsaddr->type == SOCKET_ADDRESS_TYPE_INET && g_str_equal(wsaddr->u.inet.host, "") && - !g_str_equal((*retsaddr)[0]->u.inet.host, "")) { + !g_str_equal(single_saddr->u.inet.host, "")) { g_free(wsaddr->u.inet.host); - wsaddr->u.inet.host = g_strdup((*retsaddr)[0]->u.inet.host); + wsaddr->u.inet.host = g_strdup(single_saddr->u.inet.host); } - *retwsaddr = g_renew(SocketAddress *, *retwsaddr, *retnwsaddr + 1); - (*retwsaddr)[(*retnwsaddr)++] = wsaddr; + QAPI_LIST_APPEND(wsaddr_tail, wsaddr); } - ret = 0; - cleanup: - if (ret < 0) { - vnc_free_addresses(retsaddr, retnsaddr); - vnc_free_addresses(retwsaddr, retnwsaddr); - } - return ret; + *saddr_list_ret = g_steal_pointer(&saddr_list); + *wsaddr_list_ret = g_steal_pointer(&wsaddr_list); + return 0; } static int vnc_display_connect(VncDisplay *vd, - SocketAddress **saddr, - size_t nsaddr, - SocketAddress **wsaddr, - size_t nwsaddr, + SocketAddressList *saddr_list, + SocketAddressList *wsaddr_list, Error **errp) { /* connect to viewer */ QIOChannelSocket *sioc = NULL; - if (nwsaddr != 0) { + if (wsaddr_list) { error_setg(errp, "Cannot use websockets in reverse mode"); return -1; } - if (nsaddr != 1) { + if (!saddr_list || saddr_list->next) { error_setg(errp, "Expected a single address in reverse mode"); return -1; } /* TODO SOCKET_ADDRESS_TYPE_FD when fd has AF_UNIX */ - vd->is_unix = saddr[0]->type == SOCKET_ADDRESS_TYPE_UNIX; + vd->is_unix = saddr_list->value->type == SOCKET_ADDRESS_TYPE_UNIX; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "vnc-reverse"); - if (qio_channel_socket_connect_sync(sioc, saddr[0], errp) < 0) { + if (qio_channel_socket_connect_sync(sioc, saddr_list->value, errp) < 0) { object_unref(OBJECT(sioc)); return -1; } @@ -3956,20 +3934,18 @@ static int vnc_display_connect(VncDisplay *vd, static int vnc_display_listen(VncDisplay *vd, - SocketAddress **saddr, - size_t nsaddr, - SocketAddress **wsaddr, - size_t nwsaddr, + SocketAddressList *saddr_list, + SocketAddressList *wsaddr_list, Error **errp) { - size_t i; + SocketAddressList *el; - if (nsaddr) { + if (saddr_list) { vd->listener = qio_net_listener_new(); qio_net_listener_set_name(vd->listener, "vnc-listen"); - for (i = 0; i < nsaddr; i++) { + for (el = saddr_list; el; el = el->next) { if (qio_net_listener_open_sync(vd->listener, - saddr[i], 1, + el->value, 1, errp) < 0) { return -1; } @@ -3979,12 +3955,12 @@ static int vnc_display_listen(VncDisplay *vd, vnc_listen_io, vd, NULL); } - if (nwsaddr) { + if (wsaddr_list) { vd->wslistener = qio_net_listener_new(); qio_net_listener_set_name(vd->wslistener, "vnc-ws-listen"); - for (i = 0; i < nwsaddr; i++) { + for (el = wsaddr_list; el; el = el->next) { if (qio_net_listener_open_sync(vd->wslistener, - wsaddr[i], 1, + el->value, 1, errp) < 0) { return -1; } @@ -4002,8 +3978,8 @@ void vnc_display_open(const char *id, Error **errp) { VncDisplay *vd = vnc_display_find(id); QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id); - SocketAddress **saddr = NULL, **wsaddr = NULL; - size_t nsaddr, nwsaddr; + g_autoptr(SocketAddressList) saddr_list = NULL; + g_autoptr(SocketAddressList) wsaddr_list = NULL; const char *share, *device_id; QemuConsole *con; bool password = false; @@ -4028,8 +4004,8 @@ void vnc_display_open(const char *id, Error **errp) } reverse = qemu_opt_get_bool(opts, "reverse", false); - if (vnc_display_get_addresses(opts, reverse, &saddr, &nsaddr, - &wsaddr, &nwsaddr, errp) < 0) { + if (vnc_display_get_addresses(opts, reverse, &saddr_list, &wsaddr_list, + errp) < 0) { goto fail; } @@ -4211,16 +4187,16 @@ void vnc_display_open(const char *id, Error **errp) } qkbd_state_set_delay(vd->kbd, key_delay_ms); - if (saddr == NULL) { - goto cleanup; + if (saddr_list == NULL) { + return; } if (reverse) { - if (vnc_display_connect(vd, saddr, nsaddr, wsaddr, nwsaddr, errp) < 0) { + if (vnc_display_connect(vd, saddr_list, wsaddr_list, errp) < 0) { goto fail; } } else { - if (vnc_display_listen(vd, saddr, nsaddr, wsaddr, nwsaddr, errp) < 0) { + if (vnc_display_listen(vd, saddr_list, wsaddr_list, errp) < 0) { goto fail; } } @@ -4229,14 +4205,11 @@ void vnc_display_open(const char *id, Error **errp) vnc_display_print_local_addr(vd); } - cleanup: - vnc_free_addresses(&saddr, &nsaddr); - vnc_free_addresses(&wsaddr, &nwsaddr); + /* Success */ return; fail: vnc_display_close(vd); - goto cleanup; } void vnc_display_add_client(const char *id, int csock, bool skipauth) From patchwork Mon Dec 20 15:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12688375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B2CEC433F5 for ; Mon, 20 Dec 2021 18:24:39 +0000 (UTC) Received: from localhost ([::1]:56372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzNKv-0001c9-SW for qemu-devel@archiver.kernel.org; Mon, 20 Dec 2021 13:24:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKqD-0001H0-EF for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:44:45 -0500 Received: from mail-vi1eur05on2121.outbound.protection.outlook.com ([40.107.21.121]:27986 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzKq9-0001WG-ME for qemu-devel@nongnu.org; Mon, 20 Dec 2021 10:44:43 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ixxfj9pw9WSo7jJCYNJe749AjB/IPXSdygTlvVFlnAoa9RkCRwI7O8cKdvqQXuCIKzMf18yW9AIT6JQ8SpHpc8G3si94se0ybpY2Kc+0mePylyQgyerOGj5SSVOaKA9QzoCMZqJ9WF+8y1apmBjGmynKHs1Ae9lCLAomm9dVpKoaJJtm8R8vGLSgKKGYzpt4WjLhQm2J8FEjtaQ08afWtJF/pFI/DDExVLdPfxhH1DbDjCAHDKAt1lbPiFvJhuP1OsdmbpkapdlIdJ9mDkSyrZmUz5/AKDi5cxiEya00THkbqkG3ztrUWHRx2MMqNVll1/gvoWBcJnxz3WyWOccQ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wXZIMgf5ZaWJrBQHxaCTQWydZL/B81ToI3lISfFL6V0=; b=RVyNhWgvmUX9oXDvNUaBFxUJTkoXQJasop7FvRw3ktddVxA7znq0Ck95ctmGWH/hMe0nKfxM3UjN6eTjnpF6KrwjMnKG7tnlT7I1a9iTdOrULo5NPnVn3gavR0C/D9rj1ORf57KInNSN0TbgFUUKH6PLQ5BbuYRYUnrE1Pu6wY7RAF3bGwwWvwh410ka1IPe7uwkuRO8imTVMW0lRC4ApC96tR37AQl1ecCR5jgFOItyRzZLjkDvSn969Oj1lzSQz13+FuSrR4lq5Hs6VpzPsSghmiiZGgL/knMs4CIiVsFcqz7AjCQHAwVDa9lIUMiJTB80BwDXvSk8gziZb4KjSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wXZIMgf5ZaWJrBQHxaCTQWydZL/B81ToI3lISfFL6V0=; b=hWea0h9hNb1iPXvg4Y4pSw5OdrEbjyns8I/omjcveFeMQwMmTpwTHryxzgsIrru/0ofSquoqdJ3FR1z0nRyvj/02YU53DGYX4Idw7JyubCm3lj+PIKj4VKt3WAb5GpLHFx+JZki+cxhO3K/+q/pPBCxaawaAt4WLTDfp/35Dg7w= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) by DB9PR08MB6667.eurprd08.prod.outlook.com (2603:10a6:10:2af::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.15; Mon, 20 Dec 2021 15:44:29 +0000 Received: from DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550]) by DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550%4]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 15:44:29 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, armbru@redhat.com, eblake@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, vsementsov@virtuozzo.com Subject: [PATCH 2/2] qapi/ui: introduce change-vnc-listen Date: Mon, 20 Dec 2021 16:44:18 +0100 Message-Id: <20211220154418.1554279-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211220154418.1554279-1-vsementsov@virtuozzo.com> References: <20211220154418.1554279-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM6PR0202CA0055.eurprd02.prod.outlook.com (2603:10a6:20b:3a::32) To DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0f309cb9-bb1c-42d0-31d7-08d9c3cf9bef X-MS-TrafficTypeDiagnostic: DB9PR08MB6667:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I4fUHhn3O/m1mOvHsmPc8TstpAZYY/fMixnAntpCUrM5aZW9P1B5innoUvetkwJybGFK3QxBdB1SyqI57ijLumc5yfUCePk09VIl3j7V0vMed6WEj1RxFQ2ZCjDKAUWfFqmFw6re03hw/9ORBuHMVELan7g2u09CBe5jmfkZc7R+1nP3Uqz1GQjO75Vx9BfGegFJo2090SSIwdZxEvNF8BRnuG+HExkMis5NayG7JLoQ3+wuPBeKOKYhCM9ica//pIx3OPeOWyM9K++uLBMYE1YWfvCSsZbdkBR7Py9Vt5XR6tOF/yh4JxL+MtyxMDyGVJLYFaBxzVUuiZSJ8T4ouyZcBGHyAvWD4fsr7P6nyGKrrve11r2QPl/kx53rVCVl8G10BhnsCj0FQYePyHZ/YTuSwjnstCAW99qiq+t2vzGE7/xVK4vqNYFchzOXkY38UbmF7dDRHAZvMwpzoYvqbwZN5ClICC4aJRijxcsIAeE+EjnHfyCryA9A5xdAszAxUIYwRbNJkI7qeEB/9jJFt7a3vQOgIDuuPsWtuzUyffmyUXWvuW5qjVHwLnJzZKhNeppU+UFiqJYnL9XehkEgrLzKwTaUvJN6NvPVnmO+BRJT7Xgs/s8jZCUxPnyxmI1kedNZnIwRj/62hH+UnoJ+dNFXEKQHHz6bBq+Jt9eYF3grXjeAngqxifjLxafmcAu+AVgEpFgMQReA8aIk461RpA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB6748.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66556008)(66476007)(6512007)(316002)(6486002)(4326008)(8936002)(2906002)(8676002)(66946007)(26005)(38100700002)(38350700002)(508600001)(52116002)(2616005)(5660300002)(6916009)(86362001)(1076003)(6506007)(83380400001)(107886003)(6666004)(36756003)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LjXto/lJ/EuqRpUBGMe0yiSUXwVq/UZFog/IekTujeiG8zjzj5VBmj+t/yvsf5sCPKe2QklIkb4lj1on4sg3OHkBZgtx8cMLSDifZs4fIffHlx5OiRME5IFmSZish9auJBUylGGcgZH8S/3eCNF1OC2AhphKjxRH4EMyROmlvz/vmWCbuNt7mKKWYqNNQGkpcJ33VYK5ZSeWpHEgBeF4GWUrtdC2bUvs3a5dG1xh+zxxPv3yI2i/qzedU1f3VJvCS/0Q7t/YQrwxvOadvJUS9dPwMNmAcMsn/X+cQQVfBFub4z8n1GSeUAwb5dqh73FrSdQrDfBP854DmdEWVhGQ6xDI/9jdiSvqYoKYz/FPN+9qpyo8QujyNZUPDlFUoPvYltfGJcEGnu4dyJTBk5esUe7JAJ8ufH1lN/dwL8BTgPBTyq0SrAXUpm27/Dq/0Dt4a8FAn2NmVnpDl8S/atxMT30+TD/wmC+fzeUuI248jTS34r5r79HlPVmwdVZd+ZVeXoF4bkdChZ7kDAaA4C06ykLALbfHU93cpz7rF6LkUw0tjCD8aiHSzcrrXRR+/BmQq4d7IFSagBXoOQFiNrvUmULXqESIWxX/E4DT6qCcQzEXzbPkGJ584sN0qfYwHAtppw7St0Z7RguyORJhJxNmGPDvXmA1luP8GGDWpNBRHWtzwD6ptKqVJkRixKGsIVziK0wqXNlxxGGndeAnWNJGbECTiJ3e1gGpS0bMjTKWSzIuilS6HVt4pr6CqoefUSxJbEejHbRKWQwu5eygMoJIkeghJ7Bu3lFWThvLSMc3/h/22HCm1hWwDF8ZGjJXK7McUTg5XXzBqLdy7qHK2OFDhT4Vk5E5HNAGC20I/C+3M0iO2p1g5CG7HQLk8iNXcbKkfbhfLiINZgZ81Vb0M0LO8+waTSmA7UtBvBspLItgX2t+2Cqgv+aGqPuWNF4r5Am4x+puNxtXUjKWOipMMUX/kZR2E3dQ9l4pRlaNW8n7mlp/xqBAu7EEfhEIDxmkuMqp47xXdoYrvXdn9NieNOTuFBCQslCBi+MGDB/sjE8krqnRCuCYeMwPA9LhrbtFHHSO5Cr4ERjl++uGdp5UcSGSPPdDz+ul2BwIq/qEqG77WN9p9RIzOJSWii+zlUGQ6gv7JbhiUqb1obR/sJIfA8zxZnD0Lq8JbtKVbxnxvdrI89pokv928D+RdOuI70yDhqR4QJ2JUcA0dV/4wYCId4LZhc+xsVhq/QiQLekpn9e0C90zc31GIp0EVkILd2z7VXlaIDMVKj9Y4tTCzWkeIgft8I/zoG4CNOfETuGsHLYUzQrwDWrazXyDFPxyQ7PoOTrPG3vmVe6DMow/AiSNI6egNrmQDQgb/uIOT0kefRFgmZxRPc55O41ktoGVMBed//cK+IGLTrRP90/gMSpFFq5PLA52d235LUeAZgEX27u2c9ugtqASFsdsK3InkLF0ZXAnPj9VRTzhizVgZr9MzGSa5NamFHQ0wouVfrZkkTxEFvB+jNZO/NKv6HfThlBsxDjj8xbiGqGUi9w5yFVWhV1E+5u0DHXlNtps4iZ5XEDudDTXZPMZ1SOC9AbFcOoDMFQ23ukAqWeSscgIe+FfDWu6+BtAP/M3rk7kGVkwnl7792oR295FIHo0QycDtOyQ6BmtUfSzBzR2auXdiERwCnhgeQ5cG03urfjAdbMPDaP2spA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f309cb9-bb1c-42d0-31d7-08d9c3cf9bef X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6748.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 15:44:29.2377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tmyTukw5LD0zzFz+n5J8uBhz81ZT/EQkoDTXmQrAEHzotCli/g6HyQohaWgg+YXCjJLjT8AztHkIvfhzsXmBna/Oo7i79CWlgzQK8TWGUOc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6667 Received-SPF: pass client-ip=40.107.21.121; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add command that can change addresses where VNC server listens for new connections. Prior to 6.0 this functionality was available through 'change' qmp command which was deleted. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Marc-André Lureau --- docs/about/removed-features.rst | 3 ++- qapi/ui.json | 12 ++++++++++++ ui/vnc.c | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.rst index d42c3341de..20e6901a82 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -348,7 +348,8 @@ documentation of ``query-hotpluggable-cpus`` for additional details. ``change`` (removed in 6.0) ''''''''''''''''''''''''''' -Use ``blockdev-change-medium`` or ``change-vnc-password`` instead. +Use ``blockdev-change-medium`` or ``change-vnc-password`` or +``change-vnc-listen`` instead. ``query-events`` (removed in 6.0) ''''''''''''''''''''''''''''''''' diff --git a/qapi/ui.json b/qapi/ui.json index d7567ac866..14e6fe0b4c 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1304,3 +1304,15 @@ { 'command': 'display-reload', 'data': 'DisplayReloadOptions', 'boxed' : true } + +## +# @change-vnc-listen: +# +# Change set of addresses to listen for connections. +# +# Since: 7.0 +# +## +{ 'command': 'change-vnc-listen', + 'data': { 'id': 'str', 'addresses': ['SocketAddress'], + '*websockets': ['SocketAddress'] } } diff --git a/ui/vnc.c b/ui/vnc.c index c9e26c70df..69bbf3b6f6 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -4212,6 +4212,32 @@ fail: vnc_display_close(vd); } +void qmp_change_vnc_listen(const char *id, SocketAddressList *addresses, + bool has_websockets, SocketAddressList *websockets, + Error **errp) +{ + VncDisplay *vd = vnc_display_find(id); + + if (!vd) { + error_setg(errp, "VNC display '%s' not active", id); + return; + } + + if (vd->listener) { + qio_net_listener_disconnect(vd->listener); + object_unref(OBJECT(vd->listener)); + } + vd->listener = NULL; + + if (vd->wslistener) { + qio_net_listener_disconnect(vd->wslistener); + object_unref(OBJECT(vd->wslistener)); + } + vd->wslistener = NULL; + + vnc_display_listen(vd, addresses, websockets, errp); +} + void vnc_display_add_client(const char *id, int csock, bool skipauth) { VncDisplay *vd = vnc_display_find(id); From patchwork Tue Dec 21 13:37:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12689667 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0FF7FC433EF for ; Tue, 21 Dec 2021 13:39:51 +0000 (UTC) Received: from localhost ([::1]:33342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mzfMs-0005fV-12 for qemu-devel@archiver.kernel.org; Tue, 21 Dec 2021 08:39:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzfLQ-0004Lq-FS for qemu-devel@nongnu.org; Tue, 21 Dec 2021 08:38:24 -0500 Received: from mail-db8eur05on2111.outbound.protection.outlook.com ([40.107.20.111]:37729 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mzfLJ-0001SQ-Bo for qemu-devel@nongnu.org; Tue, 21 Dec 2021 08:38:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSMyfJgw56PWNlYgf7kRtGowdNV6rcQknsAx4RYZuMNGVs9N28Giitj9UZAgv13dFU4ILMJFaMI4Kak+80NHtp6CeW9Nn/2HT/XpqznSaXH7NUgejClCuTVybezkMGILQAtCev9PisONybLWFlFHnWu4WL80Gylk+ZL1XgFJgb6Ed0lzMoDugiKX3eDxI1++2of7zGizLjZ3LQ/Yp8sChkF1LlwYOz0lxZyrQ4KMTwbb7lUYU/8vKTwobRo8/GYGGRsPoOn9LLvsDciMvPkvBPfyW9ofAYNV4wsEFxn+LkroV6OVrZlSLtDoLrQjUPjIyXV3Bj1Xc6I5fV3/fOyP7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HQuXhDnS0os3JLzBsaW06j4cyyEpyj5oHFcXaPRBqGA=; b=AXkq1OJiQiJBinwwxobntGEa+OcDEvNrOqSbV09WRPs0c1QraP2bkm79LCHhqULrB0UKmNydg62Mu2nGTiE76ZmOph8SGm3629gQ2Mk6FXGvNAj/BojXVeYKRpXyG9lQxlolgredwcwQlt5D0R7LCfCmGKY7JUpdUvQKHsarfX4ALauLVy1DJ/7WsYyVpVG9ssFcup7czW2r7rdF4iARvV8ILZ5/131vvk3h8ZvEH9MeZ/bro+EpHIQtnLz+3qmhRXOCFeuduH/PAewv+48deW9G8jH8Ig+MtKtzV+HSFrdBy+UrUzBiYQcNAgvd2oxBWrkwvbKgYqreP4aULCnQjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HQuXhDnS0os3JLzBsaW06j4cyyEpyj5oHFcXaPRBqGA=; b=E6xraK40O7KHj7dzoVKQmskHbbS8PZFPcsxEtlQNC6AImOd7KGw7ercGFOpZvGC3TqjbiVSNRSjqGycCOObda/BiNeKsZmXPgYn8CRbHRdZg7fCK6rXiBq/Bgw0W7Twm9P5KCSfjGrkDADgQ3Be6WRfgvFPHoBn/TK6f8kb8+mw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) by DB6PR0802MB2408.eurprd08.prod.outlook.com (2603:10a6:4:9d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Tue, 21 Dec 2021 13:38:11 +0000 Received: from DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550]) by DB9PR08MB6748.eurprd08.prod.outlook.com ([fe80::c1f8:2b2d:9298:7550%4]) with mapi id 15.20.4801.020; Tue, 21 Dec 2021 13:38:11 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, armbru@redhat.com, eblake@redhat.com, pbonzini@redhat.com, marcandre.lureau@redhat.com, vsementsov@virtuozzo.com, bleal@redhat.com, wainersm@redhat.com, philmd@redhat.com, crosa@redhat.com Subject: [PATCH 3/2] avocado/vnc: add test_change_listen Date: Tue, 21 Dec 2021 14:37:59 +0100 Message-Id: <20211221133759.6579-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211220154418.1554279-1-vsementsov@virtuozzo.com> References: <20211220154418.1554279-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM6P195CA0043.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::20) To DB9PR08MB6748.eurprd08.prod.outlook.com (2603:10a6:10:2a7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 04c71b41-27c0-4ee2-d36b-08d9c487213e X-MS-TrafficTypeDiagnostic: DB6PR0802MB2408:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A7zxiBEhw4YoqMOkwVUNLqlTpXV2aw2DKcjI+7L3WHcheyHGSdSv+5ZNTLUY+ALqyOoQCRIAeuvYS7Wa6FOE6/plvwW2hUrjTV/pagpzujroMptpfmbBMLOp+efxLGADmhVIP26owdI9tVTvH0c1BnBLWgBS3AGuew0G3o9P0g6AomLWUTg22uK5eK5QxU5Jw1CHqZCqcXT+3acjlu5sDN3NFJNFg41RD73ICs9RcE8UizmStr5+N52M7hdPU3H8ibRglp4QHG4dn8aaGISIUd5vMC8l96Y7nbT70ikvRfy6uozn+849milG13l9M1tLfiUlIDTBJZFbsE4kD1phE3LYnKA7fo57lKlsLUAwGUbg9s+Edn9p07HcpKBdgCUD2ks/C40YB90wFyUZOwHtSOF7J9axwAeyUgOTIxDPWPzdlti2vLruJdQwmemo36gA8ZCUPLjeGJpohuR4f10g9ySs+Bi/I/I+R4qu6gUAgp6RVPFXvZ7bf7LF1pafW8PKIzk1xUFm1CQQMRtp7vHyVQ3bKXfcokbtE1FhYFIcA5KPZ0g1xfrZykXckX82Qbwq1Q7lu+hXfOuOr5NqP502Y378TI+B5Fbl6USELq3MiWzg+LcIbevBTHxYE3VG6CmRwwFQUMMBDUBfXvi5U3mr5Aj6En/Yl5pEt/QSEb/KDbisA6BzFEWWgFcFJS0FCFFwyjDd1T8fgh2wxak2BX1ZmA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR08MB6748.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66556008)(4326008)(66946007)(26005)(6666004)(6486002)(86362001)(186003)(316002)(66476007)(2616005)(83380400001)(8936002)(8676002)(2906002)(5660300002)(38350700002)(38100700002)(6512007)(6506007)(508600001)(4744005)(6916009)(36756003)(1076003)(52116002)(7416002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5PVTQdK0kEzqw20vhRvGMaZrCryn87ppsXy7mldGqJGa6rxztOquC//h6ESqXtVIITAo2GF4HLwjvCDbyffE2NwQRijPpvoHdGAgne1apOuPoYzIDVRzTt2jtVLhmpjCdhHQwTRHKpUeefdfR3S5rRn739oah7QpYMQeiVefiXcN0Ysh1AQPxNupz4YcicuPgFOhEleQh8K3i/H7gqVvnSHmiDK0zijpsjro5yOOTvnbb86hhmgmV1thLvQaoPwpG6xXDTuMsvANO6SwjABYVWE9GxPZ/0YrTHD2MYB3I/z/wyrqmBapfo4uZ/QXy0RuGeGVXTxb19ydvaCoyYrH2CUhGwGJV7wG64HwdcFMOyQDgQvYAyayTsyD1oYiTHzN4IeLf9stOPMHVN8j16H0n7rp/8YyqKRutsSCPR9fQ3frPhnDw0UyUuHTTu11QfGWYuJxxla2mhJAVQJhaVpPLYDsByeHxDAr3uDu5vl8mn9PLMfC3UBmc0abRdxdXHD0UTHzc9InwuLudxdbfs+/ssOVshFsLTIHJt4QeZbDB0xcwcV7wWM3SBdSkX580G+y/f4uyMO4ZQJImixdkc33mOL4NCyFUMenBCdLWhMER2PbQcdzzJ0oBuKDOe40yxM+E3/BU1n1EsvyQedld7BvnMxowLAIwgaiMO0Y7Nm/4Ep09NGyyakB5K+J4u23zIWOcx+Lt9NJxd1wvm0EnQRhPd7ATDHKnCGNRoqZ+Gi5xJqW7skttf0CoTGFv6rhGetCaCZ+zENvSpbLZ3b4+30fSsGrV7f7fEqmO/g/IwYa2u/DCtWLhYJL3tNOOMvPZe6re/7gw0SlEcEiw3m5yGCjONCq6S8DVl1S9YXbFv64E1iMDDCkvI3nwzJx8hqQG0pcyTUzO6TDvRP8u6ZEy37/ldVuz0M2o3DlPhkTd5isXPWZ7mvsok0MYQu31b+Sc9nbpufslcL0OwlveLz4iJjspSlx/C5smu27XjoD8ZX/4w9fvrieuQ6dze9Y67fNVMbBWkc6dkyqar++g+o03zbBWw11A+3lws6ERnlbC28MfiYsq09FzIK3Y9NV5K4CmT48GPipdwTcfLgX1ox11b3hnIhCSE8Z4Zgkzuv0UO6NN41sjuZ9eD6c9fbE07hzS6hjPXNch3EIPL9wG9mEwrPFLdrI09hR/SEza8W0FgD3XcQXHCwprd3ecKqkyeyYuuPg9V5mW+vD4DsRhN9cnd3lHvtFCpg+qsY6BKvinkwob8p2LplqjSpLclw4PMrqG3HOVoi0baUNMUkszmbJn+4KmJdwEQJd5Ihcgzclnhii3cHlxMUtRqU8Ha89Yy7sZWq+mklaeQurLZ0ZC1b+augT58Dk4ApDbjbjbA2cmuhdwUuKyfBDUBoqWdMmmWBehiIOO0DhMaT7/1VqCJZUGZsRr/5mLsYluo/MC8xZjEg9jcc+sCHmmR8vxtwn9qyoxZ1wHiq5LVEu5cKaqMf/0O0Wvl6KcnKU2sEGzshNZlGp0ywXiCHAW5ingswYgY1QwSiaVHcnP2uf/9wIT99+iI9Kg+4qORzLHqI9R/DNXm38pmRKa270QpxLRKdUk8XKPD7dlAT5UhSQRiExDRhor2tkXLElYbgy9RH1gZqv2kfRWWeqIaKjbHH0jEpD2GjNAaXSIlK51XnH7OCYZnY4Lx6betNOb07C89Xd4vjPdDsOfis= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04c71b41-27c0-4ee2-d36b-08d9c487213e X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6748.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 13:38:10.9842 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: doFADI4Ezd/OIStiU905pPJpyTh1Rmr5I4Y3noIG+/7L+OgvrN3QCqzTAuZs7SRds3Qp8zD/veQDNL3VJEj7Zqi0DRfwbjEk/OtSdlm/mGw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2408 Received-SPF: pass client-ip=40.107.20.111; envelope-from=vsementsov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_RPBL=1.31, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add simple test-case for new change-vnc-listen qmp command. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Marc-André Lureau --- tests/avocado/vnc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/avocado/vnc.py b/tests/avocado/vnc.py index 096432988f..f05ee1e00a 100644 --- a/tests/avocado/vnc.py +++ b/tests/avocado/vnc.py @@ -51,3 +51,13 @@ def test_change_password(self): set_password_response = self.vm.qmp('change-vnc-password', password='new_password') self.assertEqual(set_password_response['return'], {}) + + def test_change_listen(self): + self.vm.add_args('-nodefaults', '-S', '-vnc', ':0') + self.vm.launch() + self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], '5900') + res = self.vm.qmp('change-vnc-listen', id='default', + addresses=[{'type': 'inet', 'host': '0.0.0.0', + 'port': '5901'}]) + self.assertEqual(res['return'], {}) + self.assertEqual(self.vm.qmp('query-vnc')['return']['service'], '5901')