From patchwork Wed Dec 22 19:17:29 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: 12697191 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 00FBDC433EF for ; Wed, 22 Dec 2021 19:21:09 +0000 (UTC) Received: from localhost ([::1]:53200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n07Ai-0001Pr-QC for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 14:21:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n077b-0007Yb-I5 for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:17:55 -0500 Received: from mail-eopbgr140119.outbound.protection.outlook.com ([40.107.14.119]:46656 helo=EUR01-VE1-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 1n077Z-0001Jb-FQ for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:17:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=igNdMIYTRbHqZV2xKPPkeaxy1Lgfp10ea+0Or75/C4UscSeQnghGLYhH75VI679pOmAbfu1aKFznMiWVqOsDdswseqRzl9tiMung6CPu2WK5GoDYU025WjD1jd0i1VdKbvRmEudgdZT86PzTMpAlMEvreYMVhBNKa1NSDwdGIXl04kkZNmvEF5W5KWoCoBLSoPbVVdrBQRduEGnyBT4FfENvSCDt0Q8TwwK4GVMNCaRI8Oi6/6WozXUFYePDMyTHgzURWxRuH9StH4AkPPRtzpLVOX/oe3X1ahn4Mo5/Rvd9aeSGiDQ5R21reo4HgJ9lrZyzU++xXDvzc458O2Jfrg== 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=6NxReX+zZB11T3FWg1GzCru/y1F/eQ929AsgbRqO0ro=; b=B1oXTxpcbgGfMAtFn67B7e6l/rrVAEHc1scXPnUL+MacwuQZWNXvqXYpYg+0bQcH1+1015F66wNZ+GTQgdTLt7aWymLBlP6OKPScuC6JYXxJJAHumxxh31u0Dsf0/Ej1U0N2WK8/hz5qwleYpvx+WcETCE/aVd4ZbzRIzbqLCCjAf07B2r2/Lcn8zzMldZgSuApIGhKRyjayHAsGt6v1dbkXuc/cY5ivJCj0q9z4QfFh5kVtKXOxyol8ZWk0wtPKuObD6oLf+gzTlHdeva6BEUCj69Q/GxYgGR56mSVJycvBR/iXHaV5i3T2SrKNWoWqTkGnQo1CKqLNJxEz5o36YQ== 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=6NxReX+zZB11T3FWg1GzCru/y1F/eQ929AsgbRqO0ro=; b=IzA7CGLXWJ6ihV9UOh4Rg6r0+YqSMT+MFpIWTs8Eq0VDnL09LHzur/mnPHGC5/RegG2jm4tpDqwH7eckOTtwQ05rxnbZHu8Gi2uGzmFL0yrmp3GNXabHewe8NT2C7UqLujvIRBdR63tGYGOYiM9VYRO5z44kvgrTdmvbUXelnBo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6290.eurprd08.prod.outlook.com (2603:10a6:20b:2d5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.14; Wed, 22 Dec 2021 19:17:45 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.019; Wed, 22 Dec 2021 19:17:45 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: bleal@redhat.com, wainersm@redhat.com, philmd@redhat.com, crosa@redhat.com, armbru@redhat.com, eblake@redhat.com, kraxel@redhat.com, marcandre.lureau@gmail.com, vsementsov@virtuozzo.com, =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= Subject: [PATCH v2 1/3] ui/vnc: refactor arrays of addresses to SocketAddressList Date: Wed, 22 Dec 2021 20:17:29 +0100 Message-Id: <20211222191731.467706-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211222191731.467706-1-vsementsov@virtuozzo.com> References: <20211222191731.467706-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0035.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6580cb13-aa70-47d8-25ed-08d9c57fbbde X-MS-TrafficTypeDiagnostic: AM9PR08MB6290: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: 4A9C5fS3r02l9AkiLsGJ3gZeMKiVpw1xa82M8PkmC9IzB2rEJycZa2KBjLPDWdI32JzGHq4V4owRbgj2YlnTXIO6mmMlRBUVaqXklQLXj2i342MExlackZhCS8k11pevlP/OLHftCYAc6fBU9Xvi16UcuxjHPWw39EKLAWJ3sJXscaRs/67AAvKtXgR477372UfEMeAuaeJr7oVV5uU1oR6tzGYOT+uAfouSSie26kXY5mBYqDMkelb1g1f/tHyY290vdr7F0BZaElLhQHFRl6SGQGDq7fxqV8jHAlrTvP3UQO7OpIzHPjj75dqiEmRJAzquHOBW8VuEyZETpCIWFYrPldJscz+xf+xX9WO+OPKG0SCkOvx4oEQZfhAxgaddFa7MEaVQBtsySXNJ9pFKZgJYScBcFnEn2+6RL+BGCVBQvJtUMMMRP2FF21OYOW03V4jB4RAJORIDpVRWeSUqyx9tykYof+Z04xeE2tt+WCyar3NsDpKYcHa9phHIYpR1vyXomzeCIznLdu4bKq6QesZWMCrbx0YF/8JK2R9tspXgU2BWQKHQSrYgxKmjRcld2KRMffeWdvvkRHvObWzX6QIlX5pA3z2YSp9HdZpASao0V8L8E7mp/RkBIlyJwBt6fpguD47DryijxzXg5/M7FAk5ZyPIXMribaPQVjCQpAJP31FNlqe044tzkkrzhk6mj46Cbpj8vOfvB1In7LrAIA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(52116002)(38350700002)(38100700002)(6506007)(66476007)(66556008)(2906002)(66946007)(6486002)(8676002)(7416002)(4326008)(36756003)(2616005)(6916009)(5660300002)(86362001)(8936002)(186003)(26005)(1076003)(508600001)(6666004)(83380400001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?J9hUT4tOWwYq580IIKWe4A2QoufK?= =?utf-8?q?dAbRu77PUR/Wrm4u+Vs0YZBCJg2h9V9wrOCxgdtxx6I6isr39dgB+v7dWvxvNF1og?= =?utf-8?q?BZjZo+2FJw5tZBYFORAL1b2YYULVA09jpXJqG/r23RkbyxZc4ATcNQsKJWSg+zvhS?= =?utf-8?q?/zCIO2RZqCz/zOXzXRaHVpImLGWay0mfByYpTCyg+Lo/1g5zmQBrsOohnKk/KrCq6?= =?utf-8?q?EB6dyx5C7USJnU53uUO5NJ5CjHX08D8twKVTnOssg5qOj5euCi0NmhEpaVaMYdsvD?= =?utf-8?q?+p6sRlYKtWhWflE1zKF9wOvY4GHq14UtzKzpzelvkf2BvjgwSVn7nzCi25pHeB+EV?= =?utf-8?q?r4h1ovKGDiHpa7OdBNYotnfrk+iHjm+DHXnhbfgRFfe8Sv7SmY4Xs7xb7epc2PX2P?= =?utf-8?q?9rk1lJ5o/AQMmI2CAZ37r+EwE4IWh2aCefJDDWPHEUU8UslLmhgrAU6hCJt1MoewP?= =?utf-8?q?4LZDv/4k+rPZ93CLzYklVHzyn39RM61/+bfEIbuNQdTJvwje9Etjp/wI+tMWUXE+s?= =?utf-8?q?HQMqODBDUs0xxN4FPTqeMSI7zVvcoyi5FjAb5Q8rJcV4n8dTaf8rA5vBaM+iCubiP?= =?utf-8?q?yiFlRsdyC4hkGz5q8qkU5JILfbj8oF4Ujz0Vm1aSDYvut+yT9MFjWiu7lzMNU88OS?= =?utf-8?q?YMhSZ/woijVgj/kloiEiQJy/7VbtmBXTb4dSPv6mHh3UvmIiEJjOZXBth/aTgfhie?= =?utf-8?q?tVE89k0UvmXAEyClORijHVDnigsTaZFaJsbXBAUyxP9jlng2eEeOcdJU7CPz1rAFU?= =?utf-8?q?f6OQYI2t/VXRWDn3L8SXg0ML6OlArKYcGb+3EJpXNdiKTALgizXYEdqYBtlNSCoPR?= =?utf-8?q?gk5fLZIBGaTk0skL8Arwyyxquf/QZlBevSymHl47lSS2B0VQxN6yvzHOnyG41+0vC?= =?utf-8?q?ypDXbaLk/SPjEavSY/fcYDUAHvxOCjYBca4kxIZmSMoR2z6N4K4sPAGQQMaLObCyH?= =?utf-8?q?nAWTccNQeZR4AwWg3NKoALfftEmCqUCoYnyBZKCnOWAvJxNXTlc/ZNBd6qP93QqpL?= =?utf-8?q?PcjCoVqrCmUcyBtB2uwUH3S0YIbN9T5Rq1lHbmgzkacHxB6i78iHLph1883vYffQ1?= =?utf-8?q?IWSien342etHuendhLvEQlV/IFlDxB9gFJe39UMnIYLCkeKEcImSJeWQZkgHR9QQ1?= =?utf-8?q?fQg5HpCWhB7Vl8hPuPaxEpFIHEyoOFuRLzng76I95x/G4PlKKfe391WLiwI81XU0k?= =?utf-8?q?K5LnP6VZKX6wrUY3Bjv+AxkwZbXrILKKo+iIjyBOiezyNs+ewxTA7KMe2sNflHJx1?= =?utf-8?q?lZGxxEXejtDQo5fVoIQhrr/BwA2c8tsB2BGsH8vIibdJ7mHa8hI/v/dIBgeAryOUu?= =?utf-8?q?+t1Cxjf7WLThpQ82911ft6+J5/uB9+c0GgTM5RcgCfrlsiwM4ZhxevKlZnZZaZcch?= =?utf-8?q?TfkecxfSdjKKVUuLTjS212hghqzDiRk0Os6bffw07RG9+//L/g1SYXNDlNpuGvgoU?= =?utf-8?q?4tqS2KqqEGD09eAioS1UP9qYXVALexpBwFwkb2J3riGkcHY/7Zmic4pup9jjbIcZu?= =?utf-8?q?yd7WRqys+R+hA46Ubh+FJC3AFlpfpfhZuxYVEzOCwxgHjC+98VT466cvAWe+Rdv5J?= =?utf-8?q?7n5xIdv7EQJV2KKXB5ifuK1TCcro8tlX+tk3uQVwR1McVysfvmIbVQ=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6580cb13-aa70-47d8-25ed-08d9c57fbbde X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2021 19:17:45.5708 (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: rf5Ectp28Avoov/Q7VIenA2xNaDHajmE8ukTef205vQte3JDTZMcA8QUj/QsQt5Zeg5A9rVtAk+HjZA9YwFfM6J9eT3m4TfTDFvNWMjLNfs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6290 Received-SPF: pass client-ip=40.107.14.119; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-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 1ed1c7efc6..e8430531c0 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 Wed Dec 22 19:17:30 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: 12697190 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 E9727C433F5 for ; Wed, 22 Dec 2021 19:21:07 +0000 (UTC) Received: from localhost ([::1]:53110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n07Ag-0001MU-PH for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 14:21:06 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n077f-0007aY-IG for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:18:00 -0500 Received: from mail-eopbgr140119.outbound.protection.outlook.com ([40.107.14.119]:46656 helo=EUR01-VE1-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 1n077b-0001Jb-RH for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:17:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qo3YddyijB6mDZuMLlXQGas8ISRqaCmOG5gw7tCWC/Q46DAVE5smWaSEN+cB8+iyL/w4gNGWEza5h9U5JiTEcYNyPnvBO6i+vGMC7MOv0DpClsyQg3bZYQKJHjKh7L5Ds9oXP7s2qTz4JJAjnMpZCu/RM+PcIzn2dOGFTKDnwnPJ+DP6Ixf0VGGh8W1kr2cIOJ8FNqwQ5G+AxySqL/iL3dMF3RQryb579tAbxdr6i15Kaap9z8vpBKU4hEWwJTIMiTakiEtgiCV2qXcEYhKzBbPrRCmmIS4+Slhm5rQ0x/77GagP97W8HQkufP8KWVxm9/G35mEeKxNmjg0G4FsxcA== 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=GVkvxmXfslKFa7aAHicEUtg8JE/6RDsWCgsb7J2iGN8=; b=TtjYt94k2LU9U4fzFxRn8spv+KwuNha89GpxeOoqpbkd3qjtII1VBUBhYrZt1MrA8Trc3T9rtamN4UiOJCkUX4MsAsA/z25zePfpLdASWmD5sqSu8JEB86ehHp6eMxeBo1WVQRXBA9SU/StU4YG6hBjNSv1fyjAlqPJoR8Ro+6LOGNXaAGPk2Au1eQv5PtjWy/e2NW76CVz5eKDPGmedIa5MWc++GzYRKSb3cmXli0PH5A1DMlcsSq+zV1WKfhwzVLhT+ETfedOTnTPW6PE7KZPjGVOeTPg+pfyXG3Kc6JOZ41fT6qs7IOgoWqYCMuUql0XFbmPvDFHAdP4i3GMijg== 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=GVkvxmXfslKFa7aAHicEUtg8JE/6RDsWCgsb7J2iGN8=; b=TqT4T7W48FjBD7EPJS2L++2IGNVp5noQvoTVQpvMCzg7Nr7STt0ePYTtjO0CISc24rmpk0Xu3/8CB5Mr4PgZu4NKhwGJQbKepU/JmX0VpTIiZRiMocWN/qUQQV8RvjnneokaCfNFBbgvyFmU0inu/UzHQgeDiPk0BvkVTqsobWg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6290.eurprd08.prod.outlook.com (2603:10a6:20b:2d5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.14; Wed, 22 Dec 2021 19:17:46 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.019; Wed, 22 Dec 2021 19:17:46 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: bleal@redhat.com, wainersm@redhat.com, philmd@redhat.com, crosa@redhat.com, armbru@redhat.com, eblake@redhat.com, kraxel@redhat.com, marcandre.lureau@gmail.com, vsementsov@virtuozzo.com, =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= Subject: [PATCH v2 2/3] qapi/ui: introduce change-vnc-listen Date: Wed, 22 Dec 2021 20:17:30 +0100 Message-Id: <20211222191731.467706-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211222191731.467706-1-vsementsov@virtuozzo.com> References: <20211222191731.467706-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0035.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fb7f058-5457-4eab-2fc8-08d9c57fbca4 X-MS-TrafficTypeDiagnostic: AM9PR08MB6290:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jixfIB8/9/sbLGduO6oM74/DqzIspgAVpFrc9ftceQQPS9ImBd+iqiceybORvafXiSWalXL+0PVuGIpTNctY5og5vACcMnlEsOCcyw5Ri2urbynLeqmXbF2X9hkzKFlX0OdauIuSrZQ8HihAomCbOdZLib2iEojCmYDxG0nvRc3VDQPYeRzkCaFPRFIMXmYizv4qbIs6ec1CXvTxwhD7jJ5lHkrWPxoOmEgMLDTIm37a7o+sdwTlgZK9PRLBmD+KJmAgR83yDU3Ni8nf+3PhhgCmH2xLrqACBCerACZZeUvmRDhcxd71sGOX0z6tbkeybzBJjrKRBwCLfbNuaZY2fzYcEAZINbT8pMScG8pkYz5x6DK9tzjSvQ2sBK7rQVFc9WnlCg73CrcrKGUiAZXWA+8G60fVx0rWtJfa47KLsXomYWT4EctF3DZPQocRkKNhffDwiiGUM4zOqwJbwZr2FWV9NkRFccYimyIT4LSJDQFfE4KqdaJx2BUh1lEK0Gvra0Qsitkpa8IgQ4ohbMZ7GBTZz8p5lcNInzlk1REsGar0qoJQAuJsYDKf1pX+KkyZ5llJbqP7/rHhqbXpSn992afg1WklocSRPAQCTgWameurUap324f1chAnfx887XQuwNU2wz4JT1BqN18Z8rnfI7AdYuUXJ4bFQm36T0yxKyLSLvlsJyCa+f3tCHsS15hHhCI70wAsv/NcwYSaLCDk4A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(52116002)(38350700002)(38100700002)(6506007)(66476007)(66556008)(2906002)(66946007)(6486002)(8676002)(7416002)(4326008)(36756003)(2616005)(6916009)(5660300002)(86362001)(8936002)(186003)(26005)(1076003)(508600001)(6666004)(83380400001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WgbYWQWkLYc7fLz3yp6rLjLe1AlI?= =?utf-8?q?8MwuORGo3S11+dPLymvaQwu/QKVpfvMrS3Fx1luvi7Ez0OFDVwQ9E/Zj31hoXNd0d?= =?utf-8?q?ZbkbGirPi8O6eAPAKApCVobhjnLNxAGWgWLdjlbv2ew7r9r2x654bau6zKjObQym5?= =?utf-8?q?gr/jKaaZJqYwW+VkTH0GcaDlRajbPcwtdDbF9RVcdW0NzoTtPaEQc6Wm52NtFTXXg?= =?utf-8?q?E39c8n4kd5tSZ9mTUIJ0od7tV6hAwLEh0+JKg5jaChiuCmq+UqXtRJKBovEa+atSc?= =?utf-8?q?Vk/nxWiO6WSvVNnkRyvnySteB/liP08rGo7gR0s/65JuVFcEseYjREOae0dGejA/+?= =?utf-8?q?8qkDxcjxB/xKwBPiswvF2Bj1a5y11zvi+LsU9k2NyYRsPmIzb4DQDMXY8OXus1EMN?= =?utf-8?q?Zly0Lu2hLWpF4pTG+Z+dTjNx9LbSc0Ntolqi9GVVPZ/RgWnFrOD8MT7/nFtSgqZc+?= =?utf-8?q?khuilnEFgbzul4rIZ1IIwwY87d/CU/g/cOvpMJCFB8C5Ywz+PdU/u5z9m2EDQ+9Nd?= =?utf-8?q?Wu0Ek+Rl2pTRBfD0OZOVzSuLseInaxlq6StUTibQY1pIgGUYC/jmVlqBYGlj7RNDh?= =?utf-8?q?cDqqCvXnZFjQww7TB0IyEKVU4yS7220cnUbx0Y1EQKjxRh0rz/tOrBKz8VI80ukRE?= =?utf-8?q?giB2Qkzh0o+BquMYc2F0ovWcdL254+6EF9ylpCeBhfJTI74Vptv5bDu4jLvMRGYPN?= =?utf-8?q?Low18XGLMKzogaodruBz/xKw1iLyQs9LHKmvkyPPaC7p8yu73MSwzFftttOUHicmu?= =?utf-8?q?Ou74gIGTfQ2Izmiy4SNsLlaULeO8dpz24zhVHOqXOtBr2glKpGkKXFWU9PzDvKzjW?= =?utf-8?q?CF4RMuK6f6yCNE7/6sZW8zNkz0TbCNLWvAjNZJULeORcZyiF7vf6H83o/XVZ8mNZc?= =?utf-8?q?43Maasiwkw8z3u1IFzkFYXd1xd9GeRPRRYOZYxFG7VdBarqrJQ42TqFHDWXLoWGQH?= =?utf-8?q?1aoJ0goDZq28XiGIFm1830Pfkcx41D7U7JCm2vSwy0Euo/25abtL/BzGSBT3/hmZQ?= =?utf-8?q?ZIlHGhYUK97lNRhsrDgs855RMoHJVzwBAfOFUz5MTTMLz9Mapb9puwirxpBG1CJna?= =?utf-8?q?X1dGwRWAuOB/wY7+fOTd2JcEASIAUTy13UFEqpKZd6lsO4H3rKuqfNxDEc0v8wC6G?= =?utf-8?q?SqQeHrEEmuTqvUrC4/g9K5lrPFW+g1u00mSZlul4gNA6TDZ/sGC2cuhCSuUnJPBZu?= =?utf-8?q?5nCTJEDwjFTuemLwPeGK4AdrDLWSVbFRTnW6XRT/j4JxGfeDJGHHBTFmk062VMHwU?= =?utf-8?q?ssY9GUDfvhCnQRIubuDGMfmuKRLVky1gxEp1w1pp4cDsWZz0zh2d/h5kwiPq/T1RK?= =?utf-8?q?07hYitFtZSsel6UmoL0tfY8cOnVvYOyZQMp64wIcPZbDJsWH1/en5nTEXgjVoO4Bz?= =?utf-8?q?h3FpT1Dk2f1oHnwM6g7qHQXJ+ECo2n+qTSk0i/pMgv2huN5t0NMyKgGYlsQzqJnEb?= =?utf-8?q?7zsDUUEVZYVYWNKVc0fQP6eKWMAVBNRYkasYy7+CnJqoVTHYmELo3EFiLCrCWTx78?= =?utf-8?q?0SkvYplc/1/Rorul0smme93bz5xglUWWpc9UELHAgDiPRTIM8LYrtNUv2yYu1Qrlb?= =?utf-8?q?j9HjzWAZGtchx5L+Np5IVS4c4qYnbJsbxqbyjfGa65QQ4vSf+EpPh4=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1fb7f058-5457-4eab-2fc8-08d9c57fbca4 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2021 19:17:46.7749 (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: 3J2b3tsfMJngcveWi4lwrtjnaGg7PcDanwG9p63+g94ijwoPm1HMsd93HQHSYL4S0BzSZcq/QnU/wN+sSh+xxsMT6FhZMiYctnDeKXM+8b0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6290 Received-SPF: pass client-ip=40.107.14.119; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-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 | 19 +++++++++++++++++++ ui/vnc.c | 26 ++++++++++++++++++++++++++ 3 files changed, 47 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 2b4371da37..6a586edff1 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1334,3 +1334,22 @@ { 'command': 'display-reload', 'data': 'DisplayReloadOptions', 'boxed' : true } + +## +# @change-vnc-listen: +# +# Change set of addresses to listen for connections. +# +# @id: vnc display identifier +# +# @addresses: list of addresses for listen at +# +# @websockets: list of addresses to listen with websockets +# +# Since: 7.0 +# +## +{ 'command': 'change-vnc-listen', + 'data': { 'id': 'str', 'addresses': ['SocketAddress'], + '*websockets': ['SocketAddress'] }, + 'if': 'CONFIG_VNC' } diff --git a/ui/vnc.c b/ui/vnc.c index e8430531c0..d7d0d255fc 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 Wed Dec 22 19:17:31 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: 12697249 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 B2A8BC433F5 for ; Wed, 22 Dec 2021 19:26:31 +0000 (UTC) Received: from localhost ([::1]:60262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n07Fu-0006Mt-CM for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 14:26:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n077h-0007bY-JB for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:18:01 -0500 Received: from mail-eopbgr140119.outbound.protection.outlook.com ([40.107.14.119]:46656 helo=EUR01-VE1-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 1n077f-0001Jb-Mi for qemu-devel@nongnu.org; Wed, 22 Dec 2021 14:18:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HzoUHvcvwxn6UYT79cq9B1Hon6vNdc7F5XE2cmVGVZmRi1zGr4Fsg65Ich4ilvnrF4AzhrvIZkmOes+hl+/Zb+wc+zy9CyykhXWL0xJYf+nvy2grh9hlx99ZMXIhX3WmCpMHTYSnoeJzE7oHnBFQAU1UGgD1NqsodVskC+ujIK90R8bpxSneXVRx//CoUnBSayqC0gRBp7qkfWyyLkyQqgpp7/BCLHKwgN633x1fK89Y8F6Aw5FgRowP7lhMmbEpeqzRqspLlUgXJBxnGkiXYYb1uGUgFU5NSun195h4VAw1Z6qO/ysvNROHTyXwD4l1SJAu6qp7QNEAFKYZlX5atw== 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=llS1TjyFmWvFLtpCGp2YfKO92lT1wDZw4gFm+qt4bb4=; b=LAR6DNIOA7Wyx7K8RgN+BSuMiWDbA4rXetuCfVHvVG6HYk5YvCi/2ZQHJ91yh8naKbX+vokb6IVKjrPd6PIkWgLok/Cn6NE7ZLmmFEBvnYBHsfK6IfDP3u4uBn3TdwuwgzV7ivybh7bSDatRfNqlqh5WO7Uz18V5+dH4v0WKEHn41O/VUAVDuhQvWZMKSzarPaWD/PDrJEcqYuYCg7F0hTcotswQOUZvZK6t12P3DQviBFs39pobkqNcoPipCcJ/S7eNVZ104qzIzxG+h5jQGNbBxLagcFwRIhN0lkVJ5Z0Xw9rhkTiknjLyCZm0p8xHl0rBXFuY8EZTbP5fwojy7A== 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=llS1TjyFmWvFLtpCGp2YfKO92lT1wDZw4gFm+qt4bb4=; b=GvVpZzwtKySYzXCaRT9BfagVTbUuNGbdc4aGmRWOmzKlSy/M2+ADwzRh53dDUkCOsRNV6FkC1nDw463VAEQl8vQuoTSBS0VZ7nx00MXLqYGlip91jW2X/FDCvzgjqoZPm4Ir00hYG9S7PkK2hxyphRRRGNF04j4mX5y7BDaa6Js= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6290.eurprd08.prod.outlook.com (2603:10a6:20b:2d5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.14; Wed, 22 Dec 2021 19:17:48 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.019; Wed, 22 Dec 2021 19:17:47 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org Cc: bleal@redhat.com, wainersm@redhat.com, philmd@redhat.com, crosa@redhat.com, armbru@redhat.com, eblake@redhat.com, kraxel@redhat.com, marcandre.lureau@gmail.com, vsementsov@virtuozzo.com, =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= Subject: [PATCH v2 3/3] avocado/vnc: add test_change_listen Date: Wed, 22 Dec 2021 20:17:31 +0100 Message-Id: <20211222191731.467706-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211222191731.467706-1-vsementsov@virtuozzo.com> References: <20211222191731.467706-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: FR2P281CA0035.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:14::22) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a29555c-75f0-4f3d-c4ba-08d9c57fbcfe X-MS-TrafficTypeDiagnostic: AM9PR08MB6290: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: X9YAvdi36hotONVSNpy+u5hBjZFbMJFtvhCkACihlvr7DmqTjVWZVJn0/KONedkubOVgehCWl/KCVBtc1rM2C9eLjIUxDt+ccG+Tj+6LUBkRAefFl4a9ptd8J5/CoYUwcKwjU5jRFYN+KpBlpCrsFMu3GDUX+eUYZ4vbDJExiWQsoIo6VJUjTr2/FxW7tnSDw89nLVDbilJTM1X/nH/0YAOUrLdbxPWSnPy6wTLgD0LwGNIlQ+pG6fitXOjpXsbxz7QMwPoQ1ARIwRSU6vwvkHS4w1BbiBbWm1+sYeoNSLkD+jCf95y0K+uaqCw598pkoDmk6MbdnHa0t5AusAOlERz2njycIg/hfjU5wAbW5AhhMxIO9hkmqqaNX3CbWHLmFLM50gHnTqu4PYRALcCBn8zbNUgPVF8zIsSZvbeBr543WbqPINdjMXUmt9Ad54vlNpMwWMu4PC36IwK9OgoGWUR6TcszZT9d388l3vVOviSjr855RwAWmjGf+bNI4MAj+fp0wwk7G1U18UCeMb+8JEK9ASCswrEVJL/mRUwa46no8Im9vV76C826wYe9sJhL7NKXNt8Dp4us2u5BDDwphCnOQ4wXZ0T+LkXIOF4tZNTbleVzcY0rgjnO55uqwcgkfzJbNI/SkHoSp/v4xL7qjLBd3bKUgevjHQbuTGDCw7xn2iDAcIA0G7paLKDBdysvVb/9y9bVvQbWYtXSM/m4kA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(52116002)(38350700002)(38100700002)(6506007)(66476007)(66556008)(2906002)(66946007)(6486002)(8676002)(7416002)(4326008)(36756003)(2616005)(6916009)(5660300002)(86362001)(8936002)(186003)(26005)(1076003)(508600001)(6666004)(83380400001)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GfQkqCAxg+Z1xvlov1rDtfs48KG+?= =?utf-8?q?RX9XhutRwn3yhxhYaouABVWlF5mYysNaxU4t+lVI/TR9CraaTTS5XvgzGSfgFJXNE?= =?utf-8?q?JN5zgXFECWjq6oB90nMYE1QEJITc7dJGuJenlf8MIEV/oF6n+++k4PQBsZv5yIFGW?= =?utf-8?q?b6i/aUNOw8LsspxQOJuD5LIo9ILYX6Pp5z0Wf8zMQ/FB/0YyY3RsWlqZB4JJdR1Lu?= =?utf-8?q?N3NEZFRr2Nw5oJFyLr/bt4U4SXDt0vcwRp2mmwtyMuhMkqb/6HgQzwnFYyGccgIRX?= =?utf-8?q?Nl1hqINFeDOXXY3XP7rm4qpb03r3XiHjdynWaIuULdRU0k9Jz60vOi/ToUw9sXF43?= =?utf-8?q?OCIol3lrmUfXm4mussfo7PCrMt5FF5XhYtu9oSET2fwHTU1/4WUTSqk0lMutVv0fW?= =?utf-8?q?WUqstcha8X1NMuy5GjjBusElyOPgUEz+3Fowh1kmJnGFJzKcm2xTRfkkuiDcxorc/?= =?utf-8?q?cFPlA65bLgJ7xKIPYk99iBZX8adwyTLCk7khqNwFE3Z4ThIl+xRQL2jmtdbIrcCvH?= =?utf-8?q?qxsvZwoETz6/WYTKGkigm/2VQmjRYYjHnHKzXH4g+4rpwRZU/L760uYdAvHhVtJM+?= =?utf-8?q?7Xu1uMLMFyuEuOAuQeEr4rDhLa91offDZ90iHpSn9TmJXCOFVOF5grzzto7J6xL7r?= =?utf-8?q?TqCPGhxBnwR5ZC/IJKxK4GqC5FnLub3vTpPWS6CF1kLx0BPdgs2MwvK79Q8J6xOK1?= =?utf-8?q?9fz2wmHgfD7qzA/MFKKEjT09uj8s1Kf0r6HO3gUS9VxaFwxKMzDEA09AN1jXFuV7y?= =?utf-8?q?QYRf7hUbUTpDVYr8zWojGVOk7I/luM6UDRE4X553x5wV2E33jOSrhOGVrbsXDSjqa?= =?utf-8?q?tkDqobHdUharQxmWfgaQo8MCho93z8o/jsrrfqQTPb5632yJ/J35wtXEK15h79URb?= =?utf-8?q?cNNF7enLRJQjjl+xWCtEu6LqR4uxBaU0S5JTO2FzPQ0M8DzfMrRppG/0oGhuSscKt?= =?utf-8?q?x/qb7DCQ3v/xB0ooJ+5PfIwtoeSRPPIXdohBmcBKOiT3yKwarIg0ETgEDDv6FUmc+?= =?utf-8?q?MWNsHyyzpeJMvnqirbWQFiwEuLmN9WwALvadvsw60gsDrbhWpov/oBROZkVmLQL1P?= =?utf-8?q?g4Pb5nn3uQ8nGsYuiHkH2BZwVM1+ZlemJUb3ZSXTBaaKvcs6JOgVQpVZybQQtZbfF?= =?utf-8?q?SQ+PY9IVfs1SkL90M7I1ZTOpwgr9gruX83z92CjN8gBMSlOCrGPTsdCKwWSG8kZWm?= =?utf-8?q?j6dIeVQNKpug3WEpjz+tVebRAY6elGnxtqynBZ9WXVMNgFnRRAj3FQHetqvNDJUII?= =?utf-8?q?ytBDUW7k2XbvRH0yFl8hI9F+0twioLct1xeUuellJMxmNCW2i8Be+YEJG6pFt/DQs?= =?utf-8?q?orVq5HtcuIO5+gcZCf2o8vLWEu7ClN+ks40m1mcVW7jMrz+O39JBUo1PWMvxc1Yif?= =?utf-8?q?Z1dAeX1TcdfdV4xzs2mfW+4sgm1VLt9hGW8k3Te8JU/iLs7MdfZ2JtKgD7PFaRYZ4?= =?utf-8?q?4KQU25vTdt2r1d0DZuQU/AnOOxoYTCXy/jYWJDq7dhQoJPBjSWXywYZHqT6cYmSUQ?= =?utf-8?q?aw5jlY4pkBQbSUxCp1nMVktPolPqSunOmQgdDyjG44E2usaCciYOKsOaUGq4XkX8V?= =?utf-8?q?8MozZpOj0+MXz4pUjz8vpw/ZC789YRm8LqdufwsxiWnCP3gPcidY9Y=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a29555c-75f0-4f3d-c4ba-08d9c57fbcfe X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2021 19:17:47.4154 (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: Dizk86y2EFeR9Uml6AuLvpnfgv0VwtsD2JBCIP2LfuwILjgJ+QO+/lUQBWFjhAuB/uZ4JLfWwBBjcgfy2v2WIi3K/AOUTAGZ8AYcJ2YPNRY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6290 Received-SPF: pass client-ip=40.107.14.119; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-VE1-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 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')