From patchwork Fri Sep 17 18:37:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 65098 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 0123AB6F0D for ; Sat, 18 Sep 2010 04:39:32 +1000 (EST) Received: from localhost ([127.0.0.1]:35806 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwfqL-0007kB-8w for incoming@patchwork.ozlabs.org; Fri, 17 Sep 2010 14:39:29 -0400 Received: from [140.186.70.92] (port=44973 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwfoV-00072e-V7 for qemu-devel@nongnu.org; Fri, 17 Sep 2010 14:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwfoU-00015s-Sb for qemu-devel@nongnu.org; Fri, 17 Sep 2010 14:37:35 -0400 Received: from smtp6-g21.free.fr ([212.27.42.6]:50989) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwfoU-000151-9m for qemu-devel@nongnu.org; Fri, 17 Sep 2010 14:37:34 -0400 Received: from Quad (unknown [78.238.229.36]) by smtp6-g21.free.fr (Postfix) with ESMTP id 577E982385 for ; Fri, 17 Sep 2010 20:37:28 +0200 (CEST) Received: from laurent by Quad with local (Exim 4.71) (envelope-from ) id 1OwfoN-0003Nk-6g; Fri, 17 Sep 2010 20:37:27 +0200 From: Laurent Vivier To: qemu-devel Date: Fri, 17 Sep 2010 20:37:25 +0200 Message-Id: <1284748645-12972-1-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 1.7.0.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Laurent Vivier Subject: [Qemu-devel] [PATCH] nbd: correctly manage default port 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 block/nbd.c: use default port number when none is specified qemu-nbd.c: use IANA-assigned port number: 10809 Signed-off-by: Laurent Vivier --- block/nbd.c | 2 -- qemu-nbd.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/block/nbd.c b/block/nbd.c index 5e9d6cb..c8dc763 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -95,8 +95,6 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags) if (r == p) { goto out; } - } else if (name == NULL) { - goto out; } sock = tcp_socket_outgoing(hostname, port); diff --git a/qemu-nbd.c b/qemu-nbd.c index 91b569f..2c7cc11 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -44,7 +44,7 @@ static void usage(const char *name) "Usage: %s [OPTIONS] FILE\n" "QEMU Disk Network Block Device Server\n" "\n" -" -p, --port=PORT port to listen on (default `1024')\n" +" -p, --port=PORT port to listen on (default `%d')\n" " -o, --offset=OFFSET offset into the image\n" " -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n" " -k, --socket=PATH path to the unix socket\n" @@ -62,7 +62,7 @@ static void usage(const char *name) " -V, --version output version information and exit\n" "\n" "Report bugs to \n" - , name, "DEVICE"); + , name, NBD_DEFAULT_PORT, "DEVICE"); } static void version(const char *name) @@ -188,7 +188,7 @@ int main(int argc, char **argv) bool readonly = false; bool disconnect = false; const char *bindto = "0.0.0.0"; - int port = 1024; + int port = NBD_DEFAULT_PORT; struct sockaddr_in addr; socklen_t addr_len = sizeof(addr); off_t fd_size;