The dsgetdcname() function assumes the local system has IPv4 connectivity. In a pure-IPv6 setup, this breaks Active Directory support. Jeremy and I discussed this back in September (and then I got busy for a while) in this thread: https://lists.samba.org/archive/samba-technical/2022-September/137633.html
Slight clarification: If a DC is configured to support both IPv4 and IPv6, and a client in that environment is configured IPv6-only (e.g. as part of a transition to all-IPv6), it looks like the logic will pick one of the DC's IPv4 addresses and ignore it's IPv6 addresses.
This bug was referenced in samba master: f55a357c6b9387883a7628a1b1083263a10121a6
Created attachment 17798 [details] git-am fix for 4.18.next, 4.17.next Cherry-picked from master. Applies cleanly to 4.18.next, 4.17.next.
*** Bug 9792 has been marked as a duplicate of this bug. ***
Pushed to autobuild-v4-{18,17}-test.
This bug was referenced in samba v4-17-test: 2d5ac37d25158dc508e8775abaf855d6b0d4b3c5
This bug was referenced in samba v4-18-test: 1ace31bc8787a72a923b1445192476cc8d71a0d8
Closing out bug report. Thanks!
This bug was referenced in samba v4-17-stable (Release samba-4.17.8): 2d5ac37d25158dc508e8775abaf855d6b0d4b3c5
This bug was referenced in samba v4-18-stable (Release samba-4.18.3): 1ace31bc8787a72a923b1445192476cc8d71a0d8