]> git.ipfire.org Git - thirdparty/qemu.git/commit
util/qemu-sockets: Refactor inet_parse() to use QemuOpts
authorJuraj Marcin <jmarcin@redhat.com>
Wed, 21 May 2025 13:52:34 +0000 (15:52 +0200)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 22 May 2025 10:24:41 +0000 (11:24 +0100)
commit316e8ee8d614f049bfae697570a5e62af450491c
treea790a66da02bbd901f61bc49512aee12dcaa80f5
parent00064705ed1f3943d3634be25da434466c87e7d5
util/qemu-sockets: Refactor inet_parse() to use QemuOpts

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 <jmarcin@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/unit/test-util-sockets.c
util/qemu-sockets.c