Re: [Qemu-devel] [PATCH 3/4] net: split hostname and service by last colon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> 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.

Why not change the prototype of parse_host_port() and modify all callers?

Kevin
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux