From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvjx3-0007Yv-NF for qemu-devel@nongnu.org; Fri, 10 Feb 2012 01:27:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rvjx2-0003dQ-IN for qemu-devel@nongnu.org; Fri, 10 Feb 2012 01:27:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rvjx2-0003dB-95 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 01:27:20 -0500 From: Amos Kong Date: Fri, 10 Feb 2012 14:27:28 +0800 Message-ID: <20120210062728.13397.43578.stgit@dhcp-8-167.nay.redhat.com> In-Reply-To: <20120210062608.13397.43361.stgit@dhcp-8-167.nay.redhat.com> References: <20120210062608.13397.43361.stgit@dhcp-8-167.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 4/4] net: support to include ipv6 address by brackets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, laine@redhat.com, akong@redhat.com That method of representing an IPv6 address with a port is discouraged because of its ambiguity. Referencing to RFC5952, the recommended format is: [2312::8274]:5200 test status: Successed listen side: qemu-kvm .... -incoming tcp:[2312::8274]:5200 client side: qemu-kvm ... (qemu) migrate -d tcp:[2312::8274]:5200 Signed-off-by: Amos Kong --- net.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/net.c b/net.c index 9e1ef9e..cccdb6b 100644 --- a/net.c +++ b/net.c @@ -88,6 +88,12 @@ static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) if (!p1) return -1; len = p1 - p; + /* remove brackets which includes hostname */ + if (*p == '[' && *(p1-1) == ']') { + p += 1; + len -= 2; + } + p1++; if (buf_size > 0) { if (len > buf_size - 1)