From: Stefano Brivio <sbrivio@redhat.com>
To: Jon Maloy <jmaloy@redhat.com>
Cc: dgibson@redhat.com, david@gibson.dropbear.id.au, passt-dev@passt.top
Subject: Re: [PATCH v2] conf: Support CIDR notation for -a/--address option
Date: Wed, 17 Dec 2025 23:51:36 +0100 [thread overview]
Message-ID: <20251217235136.6902af17@elisabeth> (raw)
In-Reply-To: <20251217213142.358407-1-jmaloy@redhat.com>
On Wed, 17 Dec 2025 16:31:42 -0500
Jon Maloy <jmaloy@redhat.com> wrote:
> Extend the -a/--address option to accept addresses in CIDR notation
> (e.g., 192.168.1.1/24 or 2001:db8::1/64) as an alternative to using
> separate -a and -n options.
>
> Add conf_addr_prefix() helper function that:
> - Parses address strings with optional /prefix suffix
That's not the prefix, that's the prefix length.
> - Validates prefix length based on address family (0-32 for IPv4,
> 0-128 for IPv6)
> - Returns address family and fills address/prefix output parameters
>
> For IPv4, the prefix is stored in ip4.prefix_len when provided.
> Multiple CIDR addresses use last-wins semantics for the prefix,
> consistent with how addresses are handled currently. However,
> mixing -n and CIDR notation results in an error to catch likely
> user mistakes.
>
> Also fix a bug in conf_ip4_prefix() that was incorrectly using the
> global 'optarg' instead of its 'arg' parameter.
>
> Signed-off-by: Jon Maloy <jmaloy@redhat.com>
>
> ---
> v2: Fixed incorrect error printout, as noted by Laurent Vivier.
> We now keep the old semantics, i.e., allowing multiple -a
> options for each protocol. This semantics looks wrong,
> but will anyway be fixed in my upcoming series.
>
> Signed-off-by: Jon Maloy <jmaloy@redhat.com>
> ---
> conf.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 84 insertions(+), 15 deletions(-)
man page update is missing altogether.
Not a full review, but it will be easier to review once the new
behaviour is documented.
--
Stefano
next prev parent reply other threads:[~2025-12-17 22:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 21:31 Jon Maloy
2025-12-17 22:51 ` Stefano Brivio [this message]
2025-12-18 4:22 ` David Gibson
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=20251217235136.6902af17@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=dgibson@redhat.com \
--cc=jmaloy@redhat.com \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).