[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] sockets: fix parsing of ipv4/ipv6 opts in pa
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2] sockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr |
Date: |
Thu, 25 Jan 2018 13:39:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 01/25/2018 11:14 AM, Daniel P. Berrangé wrote:
> From: "Daniel P. Berrange" <address@hidden>
>
> The inet_parse() function looks for 'ipv4' and 'ipv6' flags, but only
> treats them as bare bool flags. The normal QemuOpts parsing would allow
> on/off values to be set too.
>
> This updates inet_parse() so that its handling of the 'ipv4' and 'ipv6'
> flags matches that done by QemuOpts.
>
> This impacts the NBD block driver parsing the legacy filename syntax and
> the migration code parsing the socket scheme.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> util/qemu-sockets.c | 44 ++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 40 insertions(+), 4 deletions(-)
>
> + if (len == 0 || (len == 3 && strncmp(optstr, "=on", len) == 0)) {
Good: no parens around 'len == 3'
> + *val = true;
> + } else if ((len == 4) && strncmp(optstr, "=off", len) == 0) {
Not so good: redundant parens around 'len == 4'
Bad: Inconsistency between the two forms.
With those made consistent, this matches the logic in the static
util/qemu-option.c:parse_option_bool(), so it makes sense.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature