From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3PFu-00065s-R8 for qemu-devel@nongnu.org; Fri, 02 Mar 2012 04:58:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3PFq-00031Z-3q for qemu-devel@nongnu.org; Fri, 02 Mar 2012 04:58:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3PFp-00031D-Re for qemu-devel@nongnu.org; Fri, 02 Mar 2012 04:58:26 -0500 Message-ID: <4F5099BC.5050009@redhat.com> Date: Fri, 02 Mar 2012 17:58:20 +0800 From: Amos Kong MIME-Version: 1.0 References: <20120210062608.13397.43361.stgit@dhcp-8-167.nay.redhat.com> <20120210062719.13397.9953.stgit@dhcp-8-167.nay.redhat.com> <4F475874.8050803@redhat.com> <4F5040BE.2000807@redhat.com> In-Reply-To: <4F5040BE.2000807@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/4] net: split hostname and service by last colon List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, laine@redhat.com On 02/03/12 11:38, Amos Kong wrote: >>> --- a/net.c >>> +++ b/net.c >>> @@ -84,7 +84,7 @@ static int get_str_sep(char *buf, int buf_size, >>> const char **pp, int sep) >>> const char *p, *p1; >>> int len; >>> p = *pp; >>> - p1 = strchr(p, sep); >>> + p1 = strrchr(p, sep); >>> if (!p1) >>> return -1; >>> len = p1 - p; >> >> And what if the port isn't specified? I think you would erroneously >> interpret the last part of the IP address as port. Hi Kevin, port must be specified in '-incoming' parameters and migrate monitor cmd. qemu-kvm ... -incoming tcp:$host:$port (qemu) migrate -d tcp:$host:$port If use boot up guest by wrong cmdline, qemu will report an error msg. # ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm -boot n -incoming tcp:2312::8272 -monitor stdio qemu-system-x86_64: qemu: getaddrinfo: Name or service not known tcp_server_start: Invalid argument Migration failed. Exit code tcp:2312::8272(-22), exiting. > IPv6 address have paired colons, need more precision check. ------ parse_host_port() are used in four functions in net/socket.c: tcp_start_outgoing_migration() tcp_start_incoming_migration() net_socket_mcast_init() net_socket_udp_init() The argument type of parse_host_port() needs to be changed if we replace inet_aton/gethostbyname by getaddrinfo. So I will not change parse_host_port(), and verify Ipv6 addr in tcp_start_common without parse_host_port. -- Amos.