On Fri, May 16, 2025 at 05:56:58PM +0200, Juraj Marcin wrote:
> From: Juraj Marcin <jmar...@redhat.com>
> 
> Currently, the inet address parser cannot handle multiple options where
> one is prefixed with the name of the other. For example, with the
> 'keep-alive-idle' option added, the current parser cannot parse
> '127.0.0.1:5000,keep-alive-idle=60,keep-alive' correctly. Instead, it
> fails with "error parsing 'keep-alive' flag '-idle=60,keep-alive'".
> 
> To resolve these issues, this patch rewrites the inet address parsing
> using the QemuOpts parser, which the inet_parse_flag() function tries to
> mimic. This new parser supports all previously supported options and on
> top of that the 'numeric' flag is now also supported. The only
> difference is, the new parser produces an error if an unknown option is
> passed, instead of silently ignoring it.
> 
> Signed-off-by: Juraj Marcin <jmar...@redhat.com>
> ---
>  tests/unit/test-util-sockets.c |   4 +-
>  util/qemu-sockets.c            | 158 +++++++++++++++------------------
>  2 files changed, 77 insertions(+), 85 deletions(-)
> 
> diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
> index 60f15a4ddf..77d0767b9b 100644
> --- a/tests/unit/test-util-sockets.c
> +++ b/tests/unit/test-util-sockets.c
> @@ -449,6 +449,8 @@ static void test_inet_parse_all_options_good(void)
>      InetSocketAddress exp_addr = {
>          .host = host,
>          .port = port,
> +        .has_numeric = true,
> +        .numeric =  true,
>          .has_to = true,
>          .to = 5006,
>          .has_ipv4 = true,
> @@ -463,7 +465,7 @@ static void test_inet_parse_all_options_good(void)
>  #endif
>      };
>      inet_parse_test_helper(
> -        "[::1]:5000,to=5006,ipv4=off,ipv6=on,keep-alive"
> +        "[::1]:5000,numeric,to=5006,ipv4=off,ipv6=on,keep-alive"
>  #ifdef HAVE_IPPROTO_MPTCP
>          ",mptcp"
>  #endif

Squash into the previous patch


If you do that, then for the remainder

  Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to