Skip to content

Conversation

stek29
Copy link
Contributor

@stek29 stek29 commented Mar 24, 2025

sendmsg with PKTINFO is broken on darwin, so don't use it

udp_windows is renamed to udp_no_control since it's no longer exlusive to windows, and is used on darwin too

fixes #724 and #941

sendmsg with PKTINFO is broken on darwin, so don't use it

udp_windows is renamed to udp_no_control since it's no longer exlusive
to windows, and is used on darwin too
@stek29 stek29 requested review from miekg and tmthrgd as code owners March 24, 2025 10:14
@stek29
Copy link
Contributor Author

stek29 commented Mar 24, 2025

this is an issue with XNU itself and not with this library or with Go, so it's a workaround to avoid using broken OS APIs

sidenote: does using sendmsg make any sense if the socket is already bound to a non- 0.0.0.0 address? maybe it's better to avoid sendmsg completely if socket is bound to an IP?

@stek29
Copy link
Contributor Author

stek29 commented Mar 28, 2025

@miekg @tmthrgd PTAL: I've been successfully running coredns with this patch on macOS for some time with no issues

I highly doubt that macOS go servers are used with non-trivial routing setups where PKTINFO is necessary, but I'm willing to implement an adaptive approach where PKTINFO is unused only if there's a non-ANY binding on the socket if necessary

@miekg
Copy link
Owner

miekg commented Mar 28, 2025

thanks for this, I have no way of knowing if this is the correct approach, but happy to try it. We have some old bugs of weird things on macos that noone understood/understands

@miekg miekg merged commit 42d8cc5 into miekg:master Mar 28, 2025
3 checks passed
@stek29 stek29 deleted the darwin-udp-fix branch March 28, 2025 21:22
@stek29
Copy link
Contributor Author

stek29 commented Apr 6, 2025

@miekg could you please make a new release with this fix, so the fix gets into coredns?

stek29 added a commit to stek29/coredns that referenced this pull request Apr 14, 2025
fixed by updating to miekg/dns@v1.1.65 in coredns#7240

upstream bug was fixed by miekg/dns#1643

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
chrisohaver pushed a commit to coredns/coredns that referenced this pull request Apr 25, 2025
fixed by updating to miekg/dns@v1.1.65 in #7240

upstream bug was fixed by miekg/dns#1643

Signed-off-by: Viktor Oreshkin <imselfish@stek29.rocks>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UDP DNS: Bind to specific IP is not retained
2 participants