From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laine Stump Subject: Re: [Qemu-devel] [PATCH 3/4] net: split hostname and service by last colon Date: Fri, 02 Mar 2012 14:54:56 -0500 Message-ID: <4F512590.2080407@redhat.com> 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> <4F5099BC.5050009@redhat.com> <4F50A282.7060401@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Amos Kong , aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org To: Kevin Wolf Return-path: Received: from mx1.redhat.com ([209.132.183.28]:50246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755698Ab2CBTzc (ORCPT ); Fri, 2 Mar 2012 14:55:32 -0500 In-Reply-To: <4F50A282.7060401@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 03/02/2012 05:35 AM, Kevin Wolf wrote: > Am 02.03.2012 10:58, schrieb Amos Kong: >> 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. > Which is because 2312: isn't a valid IP address, right? But what if you > have something like 2312::1234:8272? If you misinterpret the 8272 as a > port number, the remaining address is still a valid IPv6 address. This is made irrelevant by PATCH 4/4, which allows for the IP address to be placed inside brackets: [2312::8272]:port (at least it's irrelevant if your documentation *requires* brackets for all numeric ipv6-address:port pairs, which is strongly recommended by RFC 5952). It really is impossible to disambiguate the meaning of the final ":nnnn" unless you require these brackets (or 1) require full specification of all potential colons in the IPv6 address or require that the port *always* be specified, neither of which seem acceptable to me).