Skip to content

Use SOCK_DNS extension on socket on OpenBSD - #659

Merged
bradh352 merged 3 commits into
c-ares:mainfrom
marty1885:add-sock-dns
Dec 17, 2023
Merged

bradh352 merged 3 commits into
c-ares:mainfrom
marty1885:add-sock-dns

Conversation

@marty1885

@marty1885 marty1885 commented Dec 13, 2023 •

Copy link
Copy Markdown

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.

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.

@bradh352

Copy link
Copy Markdown
Member

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.
@marty1885

Copy link
Copy Markdown
Author

You are right. I forgot that DNS can run over TCP. Description edited. I also force pushed to update my commit message

@bradh352

Copy link
Copy Markdown
Member

Seems reasonable. I'll merge after the 1.24.0 release which has already been staged.

@bradh352
bradh352 merged commit e1c5994 into c-ares:main Dec 17, 2023
VlkrS added a commit to VlkrS/c-ares that referenced this pull request May 8, 2024
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
@VlkrS VlkrS mentioned this pull request May 8, 2024
bradh352 pushed a commit that referenced this pull request May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit that referenced this pull request May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit that referenced this pull request May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit that referenced this pull request May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
bradh352 pushed a commit that referenced this pull request May 8, 2024
As described in #753 the change
merged with #659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
liujinye-sys pushed a commit to open-vela/external_c-ares that referenced this pull request Jul 23, 2025
As described in c-ares/c-ares#753 the change
merged with c-ares/c-ares#659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
liujinye-sys pushed a commit to open-vela/external_c-ares that referenced this pull request Dec 16, 2025
As described in c-ares/c-ares#753 the change
merged with c-ares/c-ares#659 is ill-advised and
leads to breakage in applications using c-ares on OpenBSD.

See also nodejs/node#52439
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
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
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
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
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
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
michael-dev pushed a commit to HamelinPorts/android_external_c-ares that referenced this pull request Apr 25, 2026
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
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.

2 participants