From patchwork Fri May 15 09:31:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Krempa X-Patchwork-Id: 472701 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 C3414140B0E for ; Fri, 15 May 2015 19:32:08 +1000 (AEST) Received: from localhost ([::1]:58715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtByQ-0005hJ-7a for incoming@patchwork.ozlabs.org; Fri, 15 May 2015 05:32:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtByA-0005Ku-HX for qemu-devel@nongnu.org; Fri, 15 May 2015 05:31:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtBy7-0005nl-CV for qemu-devel@nongnu.org; Fri, 15 May 2015 05:31:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBy7-0005nV-5W for qemu-devel@nongnu.org; Fri, 15 May 2015 05:31:47 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t4F9VjqT021169 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 15 May 2015 05:31:46 -0400 Received: from andariel.brq.redhat.com ([10.34.249.160]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4F9ViSc020363; Fri, 15 May 2015 05:31:45 -0400 From: Peter Krempa To: qemu-devel@nongnu.org Date: Fri, 15 May 2015 11:31:43 +0200 Message-Id: <4d325283e37f8f4ebf42b2e3ca41985f2e69e26c.1431682266.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Krempa , Markus Armbruster Subject: [Qemu-devel] [PATCH v2] util: socket: Add missing localaddr and localport option for DGRAM socket 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 The 'socket_optslist' structure does not contain the 'localaddr' and 'localport' options that are parsed in case you are creating a 'connect' type UDP character device. I've noticed it happening after commit f43e47dbf6de24db20ec9b588bb6cc762 made qemu abort() after seeing the invalid option. A minimal reproducer for the case is: $ qemu-system-x86_64 -chardev udp,id=charrng0,host=127.0.0.1,port=1234,localaddr=,localport=1234 qemu-system-x86_64: -chardev udp,id=charrng0,host=127.0.0.1,port=1234,localaddr=,localport=1234: Invalid parameter 'localaddr' Aborted (core dumped) Prior to the commit mentioned above the error would be printed but the value for localaddr and localport was simply ignored. I did not go trhough the code to find out when it was broken. Add the two fields so that the options can again be parsed correctly and qemu doesn't abort(). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1220252 Signed-off-by: Peter Krempa Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster --- Notes: Version 2: - improved commit message as suggested by Markus Cc: Markus Armbruster util/qemu-sockets.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 87c9bc6..72066be 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -45,6 +45,12 @@ QemuOptsList socket_optslist = { .name = "port", .type = QEMU_OPT_STRING, },{ + .name = "localaddr", + .type = QEMU_OPT_STRING, + },{ + .name = "localport", + .type = QEMU_OPT_STRING, + },{ .name = "to", .type = QEMU_OPT_NUMBER, },{