diff options
| author | Jon Maloy <jmaloy@redhat.com> | 2026-02-16 15:57:41 -0500 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-02-24 12:05:53 +0100 |
| commit | c3201915c436b47481396f0ae95b52efed084ef3 (patch) | |
| tree | b60ae91bb2febc4faa3b288198a87974045fc286 /test/lib | |
| parent | 02af38d4177550c086bae54246fc3aaa33ddc018 (diff) | |
| download | passt-c3201915c436b47481396f0ae95b52efed084ef3.tar passt-c3201915c436b47481396f0ae95b52efed084ef3.tar.gz passt-c3201915c436b47481396f0ae95b52efed084ef3.tar.bz2 passt-c3201915c436b47481396f0ae95b52efed084ef3.tar.lz passt-c3201915c436b47481396f0ae95b52efed084ef3.tar.xz passt-c3201915c436b47481396f0ae95b52efed084ef3.tar.zst passt-c3201915c436b47481396f0ae95b52efed084ef3.zip | |
conf: Support CIDR notation for -a/--address option
We 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.
We add a new inany_prefix_pton() helper function that:
- Parses address strings with a compulsory /prefix_len suffix
- Validates prefix length based on address family (0-32 for IPv4,
0-128 for IPv6), including handling of IPv4-to-IPv6 mapping case.
For IPv4, the prefix length is stored in ip4.prefix_len when provided.
For IPv6, the given prefix length is still overridden by the default
value 64
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>
[sbrivio: Fix merge conflict with commit 0c611bcd3120]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
0 files changed, 0 insertions, 0 deletions
