On Tue, Sep 30, 2025 at 01:14:02PM +0200, Stefano Brivio wrote:
On Tue, 30 Sep 2025 15:49:11 +1000 David Gibson
wrote: nl_addr_get() will only pick up global IPv6 addresses (RT_SCOPE_UNIVERSE). This is because link-local addresses aren't suitable. However site-local addresses (in the rare occassions they're used) would be fine for our purposes. In fact, anything wider than link scope is fine, so update the check to reflect that.
Change the logic in the test scripts to match as well.
Reported-by: Xun Gu
Link: https://bugs.passt.top/show_bug.cgi?id=122 Signed-off-by: David Gibson
--- netlink.c | 2 +- test/demo/podman | 4 ++-- test/migrate/basic | 2 +- test/migrate/basic_fin | 2 +- test/migrate/iperf3_bidir6 | 2 +- test/migrate/iperf3_in6 | 2 +- test/migrate/iperf3_many_out6 | 2 +- test/migrate/iperf3_out6 | 2 +- test/migrate/rampstream_in | 2 +- test/migrate/rampstream_out | 2 +- test/passt/dhcp | 2 +- test/passt/ndp | 2 +- test/passt_in_ns/dhcp | 2 +- test/pasta/dhcp | 2 +- test/pasta/ndp | 2 +- test/perf/pasta_tcp | 2 +- test/perf/pasta_udp | 2 +- test/two_guests/basic | 2 +- 18 files changed, 19 insertions(+), 19 deletions(-) diff --git a/netlink.c b/netlink.c index c4367807..9fe70f2c 100644 --- a/netlink.c +++ b/netlink.c @@ -786,7 +786,7 @@ int nl_addr_get(int s, unsigned int ifi, sa_family_t af,
prefix_max = *prefix_len = ifa->ifa_prefixlen; } else if (af == AF_INET6 && addr && - ifa->ifa_scope == RT_SCOPE_UNIVERSE && + ifa->ifa_scope < RT_SCOPE_LINK &&
Oh, I had no idea RT_SCOPE_SITE even existed.
Yeah, site-local addresses seem to be one of those things that was written into an RFC, but then everyone decided was a bad idea and didn't use. Strangely enough Xun Gu's test machine has one, though. -- 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