From: Kevin Wolf <kwolf@redhat.com>
To: Amos Kong <akong@redhat.com>
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com,
jasowang@redhat.com, qemu-devel@nongnu.org,
Laine Stump <laine@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] net: split hostname and service by last colon
Date: Mon, 05 Mar 2012 10:06:24 +0100 [thread overview]
Message-ID: <4F548210.2060607@redhat.com> (raw)
In-Reply-To: <81f93d6a-f167-4606-b322-16fdb744a5a3@zmail13.collab.prod.int.phx2.redhat.com>
Am 05.03.2012 09:59, schrieb Amos Kong:
> ----- Original Message -----
>> Am 02.03.2012 20:54, schrieb Laine Stump:
>>> 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).
>>
>> Here you're actually explaining why it's not irrelevant. You don't
>> want
>> to enforce port numbers, so 2312::1234:8272 must be interpreted as an
>> IPv6 address without a port. This code however would take 8727 as the
>> port and 2312::1234 as the IPv6 address, which is not what you
>> expected
>> (even after brackets are allowed - they don't make a difference
>> because
>> the example doesn't use brackets).
>
> In the migration context, host/port are all necessary, so it's right to parse "8272" to a port.
> However, for IPv6 brackets must be mandatory if you require a port.
Makes sense.
> BTW, the DNS delay issue existed in the past (gethostbyname()), it should be fixed by another patchset.
> I will post my V2 (without fix of DNS delay) later.
Yes, I agree.
Kevin
next prev parent reply other threads:[~2012-03-05 9:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 6:26 [Qemu-devel] [PATCH 0/4] support to migrate with IPv6 address Amos Kong
2012-02-10 6:27 ` [Qemu-devel] [PATCH 1/4] Use getaddrinfo for migration Amos Kong
2012-02-24 9:08 ` Kevin Wolf
2012-03-02 3:33 ` Amos Kong
2012-03-02 10:28 ` Kevin Wolf
2012-02-24 9:34 ` Kevin Wolf
2012-03-02 2:50 ` Amos Kong
2012-03-02 10:21 ` Kevin Wolf
2012-03-02 10:25 ` [Qemu-devel] " Michael Tokarev
2012-03-02 10:41 ` Daniel P. Berrange
2012-03-05 8:03 ` Amos Kong
2012-02-10 6:27 ` [Qemu-devel] [PATCH 2/4] net/socket: allow ipv6 for net_socket_listen_init and socket_connect_init Amos Kong
2012-02-24 9:25 ` Kevin Wolf
2012-02-10 6:27 ` [Qemu-devel] [PATCH 3/4] net: split hostname and service by last colon Amos Kong
2012-02-24 9:29 ` Kevin Wolf
2012-03-02 3:38 ` Amos Kong
2012-03-02 9:58 ` Amos Kong
2012-03-02 10:35 ` Kevin Wolf
2012-03-02 19:54 ` Laine Stump
2012-03-05 8:57 ` Kevin Wolf
2012-03-05 8:59 ` Amos Kong
2012-03-05 9:06 ` Kevin Wolf [this message]
2012-02-10 6:27 ` [Qemu-devel] [PATCH 4/4] net: support to include ipv6 address by brackets Amos Kong
2012-02-24 9:40 ` [Qemu-devel] [PATCH 0/4] support to migrate with IPv6 address Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F548210.2060607@redhat.com \
--to=kwolf@redhat.com \
--cc=akong@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=laine@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).