Re: IPv6 problems.... (dhcpcd weirdness, rshd fails, etc.)
"Greg A. Woods" <[email protected]> Tue, 18 Nov 2025 18:23:53 -0800
| Newsgroups | gmane.os.netbsd.devel.network |
|---|---|
| Organization | Planix, Inc. |
| Message-ID | <[email protected]> |
--pgp-sign-Multipart_Tue_Nov_18_18:23:44_2025-1 Content-Type: text/plain; charset=US-ASCII At Tue, 18 Nov 2025 10:42:41 +0100, Ted Lemon <[email protected]> wrote: Subject: Re: IPv6 problems.... (dhcpcd weirdness, rshd fails, etc.) > > On 18 Nov 2025, at 10:39, Ted Lemon <[email protected]> wrote: > > > > if (IN6_IS_ADDR_LINKLOCAL(&sa1->sin6_addr)) { > > This is what I get for sending code I'm in the middle of writing: > the above doesn't make sense in context. The code snippet should > actually be: > > server->server_address.sa.sa_family = AF_INET6; > server->server_address.sin6.sin6_addr = > response->rr.data.aaaa; > if > (IN6_IS_ADDR_LINKLOCAL(&server->server_address.sin6_addr)) > { server->server_address.sin6.sin6_scope_id = > response->interface_index; > } > Hmmm.... I think that gives me a better idea of what to look for, thanks! So the following compiles, but I don't know yet if it fixes the problem and won't be able to test for a bit: --- lib/libc/netrcmd.c.~1.71.~ 2015-02-19 20:58:57.000000000 -0800 +++ lib/libc/netrcmd.c 2025-11-18 18:03:06.845451361 -0800 @@ -542,9 +542,12 @@ sa->sa_len = #endif salen = sizeof(struct sockaddr_in6); - if (addr) + if (addr) { ((struct sockaddr_in6 *)(void *)sa)->sin6_addr = ((struct sockaddr_in6 *)addr)->sin6_addr; + ((struct sockaddr_in6 *)(void *)sa)->sin6_scope_id = + ((struct sockaddr_in6 *)addr)->sin6_scope_id; + } portp = &((struct sockaddr_in6 *)(void *)sa)->sin6_port; break; #endif But maybe the sin6_scope_id field gets lost earlier (too?)? It seems silly to me that the kernel can't figure this out itself when it knows the address explicitly and completely as it does in this case. I'm pretty sure you can't have the same address on two different interfaces no matter what family they belong to. The log message showing the incoming connection even shows the interface name. > > Nov 15 21:17:32 once inetd[10044]: connection from fe80::1030:c7e5:ac6d:b5ce%bge0(fe80::1030:c7e5:ac6d:b5ce%bge0), service shell (tcp6) > > Nov 15 21:17:32 once rshd[10044]: can't get stderr port: Can't assign requested address I see there's also inet6_getscopeid(3) that seems to just look in the address to get the id. -- Greg A. Woods <[email protected]> Kelowna, BC +1 250 762-7675 RoboHack <[email protected]> Planix, Inc. <[email protected]> Avoncote Farms <[email protected]> --pgp-sign-Multipart_Tue_Nov_18_18:23:44_2025-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit Content-Description: OpenPGP Digital Signature -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRuK6dmwVAucmRxuh9mfXG3eL/0fwUCaR0qMgAKCRBmfXG3eL/0 f1taAKDff85hLnP1PT9gSld6iuuMYmHIAQCfYO/mGd/XuQrM2cUvAgxwtyK1fAc= =cFur -----END PGP SIGNATURE----- --pgp-sign-Multipart_Tue_Nov_18_18:23:44_2025-1--