-
Notifications
You must be signed in to change notification settings - Fork 634
Use SOCK_DNS extension on socket on OpenBSD #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Interesting. That said, the manpage, https://man.openbsd.org/socket.2 doesn't say SOCK_DNS is limited to UDP. DNS will upgrade from UDP to TCP if it gets back a DNS response with the 'TC' bit set indicating the response was truncated due to UDP packet size limitations. Are you sure SOCK_DNS is really limited to UDP? It wouldn't make sense that it would be. |
This patch added the SOCK_DNS flag when running on OpenBSD. Allowing a reduced set of pledge(2) promises. Before this patch. The "stdio rpath inet" promises must be used in order to resolve any records. After the patch. inet can be replaced with dns which only allows communication on destination port 53, instead of on all ports.
06692b3
to
b5a5a86
Compare
You are right. I forgot that DNS can run over TCP. Description edited. I also force pushed to update my commit message |
Seems reasonable. I'll merge after the 1.24.0 release which has already been staged. |
As described in c-ares#753 the change merged with c-ares#659 is ill-advised and leads to breakage in applications using c-ares on OpenBSD. See also nodejs/node#52439
This patch added the SOCK_DNS flag when running on OpenBSD. Allowing a reduced set of pledge(2) promises. Before this patch. The "stdio rpath inet" promises must be used in order to resolve any records. After the patch.
inet
can be replaced withdns
which only allows communication on destination port 53, instead of on all ports.Side note: I checked the OpenBSD kernel source code. Even though the socket document says
the DNS port (typically 53).
, The OpenBSD 7.4 kernel only allows 53. Not sure why they say typically.