Re: IPv6 problems.... (dhcpcd weirdness, rshd fails, etc.)

Ted Lemon <[email protected]> Tue, 18 Nov 2025 10:39:18 +0100
Newsgroups gmane.os.netbsd.devel.network
Message-ID <[email protected]>
On 18 Nov 2025, at 08:43, Greg A. Woods <[email protected]> wrote:
>=20
> At Sun, 16 Nov 2025 11:09:24 -0000 (UTC), [email protected] (Michael =
van Elst) wrote:
> Looks like a bug, the scope somehow gets lost and rshd cannot bind
>>=20
>> to an unscoped link local address (the scope references the =
interface).
>=20
> What does "scope" mean in this context?  Isn't the scope whether it is
> link-local, site-local, or global, and isn't that inferred from the
> prefix?  How can that get lost?

I suspect it's something like this:

                server->server_address.sa.sa_family =3D AF_INET6;
                server->server_address.sin6.sin6_addr =3D =
response->rr.data.aaaa;
                if (IN6_IS_ADDR_LINKLOCAL(&sa1->sin6_addr)) {
                    address.sin6.sin6_scope_id =3D =
response->interface_index;
                }

For link-local addresses, you have to set sin6_scope_id or else it =
doesn't know which interface to send the packet on, because link-local =
addresses are link-scoped. It's a confusing use of terminology, to say =
the least. The scope ID is just the interface index, not "link local" =
versus "site local" versus "global."

(The above code is using an mDNS query result, which should always have =
an interface index if it's from mDNS and not DNS.)