On Sun, Feb 22, 2026 at 12:44:37PM -0500, Jon Maloy wrote: > nl_addr_get() was not setting the prefix_len output parameter for > IPv6 addresses, only for IPv4. This meant callers always got 0 for > IPv6, forcing them to use a hardcoded default (64). > > Fix by assigning *prefix_len in the IPv6 case, matching the IPv4 > behavior. > > Signed-off-by: Jon Maloy Reviewed-by: David Gibson Moving this patch before 1/13 would address my comment there about the never exercised check on the prefix_len from nl_addr_get(). > --- > conf.c | 2 +- > netlink.c | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/conf.c b/conf.c > index f2ff8af..eb967c7 100644 > --- a/conf.c > +++ b/conf.c > @@ -814,7 +814,7 @@ static unsigned int conf_ip6(struct ctx *c, unsigned int ifi) > if (!e) { > e = &c->addrs[c->addr_count++]; > e->addr = addr; > - e->prefix_len = prefix_len ? prefix_len : 64; > + e->prefix_len = prefix_len; > e->flags = CONF_ADDR_HOST; > } > > diff --git a/netlink.c b/netlink.c > index 82a2f0c..769cb23 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -752,7 +752,7 @@ int nl_addr_set_ll_nodad(int s, unsigned int ifi) > * @ifi: Interface index in outer network namespace > * @af: Address family > * @addr: Global address to fill > - * @prefix_len: Mask or prefix length, to fill (for IPv4) > + * @prefix_len: Mask or prefix length, to fill > * @addr_l: Link-scoped address to fill (for IPv6) > * > * Return: 0 on success, negative error code on failure > @@ -797,7 +797,7 @@ int nl_addr_get(int s, unsigned int ifi, sa_family_t af, > ifa->ifa_prefixlen > prefix_max) { > memcpy(addr, RTA_DATA(rta), RTA_PAYLOAD(rta)); > > - prefix_max = ifa->ifa_prefixlen; > + prefix_max = *prefix_len = ifa->ifa_prefixlen; > } > > if (addr_l && > -- > 2.52.0 > -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson