On Wed, 17 Dec 2025 16:31:42 -0500
Jon Maloy
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
--- 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
--- 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