net ads dns register command will register/update DNS record at DNS. If DNS policy is round robin, you may get different IP address between dyanmic update and TKEY query in multiple interfaces/subnets connection enviroment. Running dynamic update and TEKY query in different interfaces/subnets may causes DNS dynamic update to fail. Both dynamic update and TEKY query run getaddrinfo() then they may get different address. Example: |samba box |---10.77.x.x--|Windows 2008r2 DC/DNS| | |---10.88.x.x--| dc.testdom.com | answer to 1st nslookup dc.testdom.com: name: dc.testdom.com answer: 10.77.1.1 name: dc.testdom.com answer: 10.88.1.1 answer to 2nd nslookup dc.testdom.com: name: dc.testdom.com answer: 10.88.1.1 name: dc.testdom.com answer: 10.77.1.1 dynamic update connect to 10.77.1.1 and TKEY query connect to 10.88.1.1 then fail to update. I don't know what happen in windows DNS. To aviod this situation, we can run getaddrinfo() only once then pass connectinfo to TKEY query funtion. patch will follow.
Created attachment 17796 [details] patch
Created attachment 17797 [details] patch
patch : https://gitlab.com/hywu/samba/-/commit/d8be5b7c3fd3e5c36b92c9d6c6bd9a9419ea5828 CI pipeline is passed. https://gitlab.com/hywu/samba/-/pipelines/799334261 merge request: https://gitlab.com/samba-team/samba/-/merge_requests/2964/commits
(In reply to HY Wu from comment #3) sorry for error patch link. https://gitlab.com/hywu/samba/-/commit/acdae18d2c7fcf7eeca70bf3df1489b11ab4e641