From patchwork Mon Feb 29 23:19:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 590222 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 76DFC1402C9 for ; Tue, 1 Mar 2016 10:21:11 +1100 (AEDT) Received: from localhost ([::1]:39630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX7l-0003iM-ER for incoming@patchwork.ozlabs.org; Mon, 29 Feb 2016 18:21:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX6X-0001fK-QE for qemu-devel@nongnu.org; Mon, 29 Feb 2016 18:19:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aaX6W-0006Bg-Vb for qemu-devel@nongnu.org; Mon, 29 Feb 2016 18:19:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aaX6S-0006Ak-P4; Mon, 29 Feb 2016 18:19:48 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 792EFC0B78B6; Mon, 29 Feb 2016 23:19:48 +0000 (UTC) Received: from localhost (ovpn-116-81.ams2.redhat.com [10.36.116.81]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1TNJk9w022661 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Feb 2016 18:19:48 -0500 From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 1 Mar 2016 00:19:22 +0100 Message-Id: <1456787973-19348-6-git-send-email-mreitz@redhat.com> In-Reply-To: <1456787973-19348-1-git-send-email-mreitz@redhat.com> References: <1456787973-19348-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, Max Reitz , Paolo Bonzini , Luiz Capitulino Subject: [Qemu-devel] [PATCH v2 05/16] block/nbd: Reject port parameter without host 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 This is better than the generic block layer finding out later that the port parameter has not been used. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block/nbd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/nbd.c b/block/nbd.c index ce31119..6a2fc27 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -200,6 +200,10 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export, } return NULL; } + if (qdict_haskey(options, "port") && !qdict_haskey(options, "host")) { + error_setg(errp, "port may not be used without host"); + return NULL; + } saddr = g_new0(SocketAddress, 1);