From nobody Sat May 4 07:53:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492765368556575.5358053210996; Fri, 21 Apr 2017 02:02:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BBE5C03BD5F; Fri, 21 Apr 2017 09:02:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D37AF81419; Fri, 21 Apr 2017 09:02:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 369EF18523CE; Fri, 21 Apr 2017 09:02:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3L92gbl008354 for ; Fri, 21 Apr 2017 05:02:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31CAF5C88E; Fri, 21 Apr 2017 09:02:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B4617958A for ; Fri, 21 Apr 2017 09:02:40 +0000 (UTC) Received: from mail-wm0-f69.google.com (mail-wm0-f69.google.com [74.125.82.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 287E6A329B for ; Fri, 21 Apr 2017 09:02:40 +0000 (UTC) Received: by mail-wm0-f69.google.com with SMTP id h65so868515wmd.7 for ; Fri, 21 Apr 2017 02:02:40 -0700 (PDT) Received: from [192.168.77.22] (val06-1-88-182-161-34.fbx.proxad.net. [88.182.161.34]) by smtp.gmail.com with ESMTPSA id v7sm5451739wrb.68.2017.04.21.02.02.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2017 02:02:37 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1BBE5C03BD5F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1BBE5C03BD5F X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=Xta+YDxZODQX2uXz+byXq2rGpFaX/LHnRIMFHjctNb4=; b=DYnTrS2jfYwqRzStKsft1KtoxE0OaHUKcC49LCOP+t3qYpbIsQmpbLiS/WN2YxQC7N YF+EHrrIod6/byWccOIQe/wdqGHeY4xLaOaojfsMSCtsg8nvvSuY5uuMbDPfjsc3wJRC ZGWyvJBuqdkgJgSQ1+ynG/j7r0y7n4cS04HKjg3vIQryay8Hn4qh18TqEGVPVW7V2lhU mrE2ouRfGPg9elEFF+v5vQL2FRymBLNv+Wl21tAa6GdKkJRgD9Ns14NzojiQyDYOU0qe +FOGwirp7gBWGsLFCyYvnUHDVSxkDDo8CyqYv5gXUs50t85AEeS7AFjN7surEehqjmaW d1dw== X-Gm-Message-State: AN3rC/4Oe1VPZ/Q10gJmba3mo/KhukrZjLCnCw3FkS/9bnAHItL9+GGe twNl7KP/SrAiP2n23S/TW5s8IPEH9iJWkyohn7RWKQp0KQQdiCJz9FrPJSQvXyMl/wRBUy4KpoO PNebvZqllHjG19nM= X-Received: by 10.223.164.195 with SMTP id h3mr11400950wrb.135.1492765358723; Fri, 21 Apr 2017 02:02:38 -0700 (PDT) X-Received: by 10.223.164.195 with SMTP id h3mr11400935wrb.135.1492765358521; Fri, 21 Apr 2017 02:02:38 -0700 (PDT) From: Christophe de Dinechin Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Message-Id: <4B91F963-21C9-4DDB-A64A-A08E126BC8A4@redhat.com> Date: Fri, 21 Apr 2017 11:02:36 +0200 To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id v3L92gbl008354 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] Use port range 5901-5999 if not set in qemu.conf, avoid port 5900 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 21 Apr 2017 09:02:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In order to avoid conflict with the default port (5900) for host VNC server (vino-server for example), or to conflict with X11 (starting at port 6000), restrict range of ports to 5901-5999 unless explicitly specified in qemu.co= nf. On the other hand, if port range is explicitly specified in qemu.conf, there is no reason not to allow ports 1024-5900 (system ports are below 102= 4). Addresses https://bugzilla.redhat.com/show_bug.cgi?id=3D1442235 Signed-off-by: Christophe de Dinechin --- src/qemu/qemu_conf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 1b704da..07f3177 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -65,9 +65,15 @@ VIR_LOG_INIT("qemu.qemu_conf"); * This limitation is mentioned in qemu.conf, so bear in mind that the * configuration file should reflect any changes made to these values. */ -#define QEMU_REMOTE_PORT_MIN 5900 + +// Range of available ports - Avoid ports below 1024 (system ports) +#define QEMU_REMOTE_PORT_MIN 1024 #define QEMU_REMOTE_PORT_MAX 65535 =20 +// Default min and max if not configured in qemu.conf +#define QEMU_REMOTE_PORT_MIN_DEFAULT 5901 +#define QEMU_REMOTE_PORT_MAX_DEFAULT 5999 + #define QEMU_WEBSOCKET_PORT_MIN 5700 #define QEMU_WEBSOCKET_PORT_MAX 65535 =20 @@ -283,8 +289,8 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool priv= ileged) =20 #undef SET_TLS_X509_CERT_DEFAULT =20 - cfg->remotePortMin =3D QEMU_REMOTE_PORT_MIN; - cfg->remotePortMax =3D QEMU_REMOTE_PORT_MAX; + cfg->remotePortMin =3D QEMU_REMOTE_PORT_MIN_DEFAULT; + cfg->remotePortMax =3D QEMU_REMOTE_PORT_MAX_DEFAULT; =20 cfg->webSocketPortMin =3D QEMU_WEBSOCKET_PORT_MIN; cfg->webSocketPortMax =3D QEMU_WEBSOCKET_PORT_MAX; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list