mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #3036] [hickory-client] "Operation not permitted" trying to run the provided example #1115
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#1115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @0xb01u on GitHub (Jun 8, 2025).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/3036
Hello!
I am trying to run the example provided in the README of the client crate. I just wrapped the corresponding code in a
#[tokio::main] async fn main() {...}function, built it and ran it.On execution, the program returns the following error:
Line 25 of the program corresponds to the
unwrap()oflet response: DnsResponse = client.query(name, DNSClass::IN, RecordType::A).await.unwrap();I've tried running the program both as regular user and superuser. The result is the same.
I am pretty sure the problem is not a bug in the library, but rather a problem with my system/setup.
I am using Ubuntu 22.04.5 LTS, rustc 1.87.0, hickory-client = "0.25.2", tokio = "1.45.1".
Any help troubleshooting this issue would be much appreciated. Thank you!
@djc commented on GitHub (Jun 12, 2025):
I would guess something is preventing your binary from open a socket? Not familiar enough with Ubuntu to suggest where/why that might be. You could try setting up a tracing subscriber and enabling it with
RUST_LOG=traceto get a better picture of what's going on, maybe?Going to close this issue as it's unlikely to be a problem with our code, but feel free to comment again and I'll try to follow up if I have anything useful to contribute.
@0xb01u commented on GitHub (Jun 14, 2025):
This issue is definitely system-dependent, as I was able to execute the example code with no modifications on another system running Ubuntu 24.04. I am not sure what are the differences in configuration between the two systems, as I didn't change any defaults for network configuration in any of them, as far as I remember.
"something is preventing your binary from opening a socket" indeed seemed like the issue to me. However, I have no clue why. I searched about that on the Internet, tried some proposed
iptablesconfiguration to open all sockets for potential communication, and nothing I found or tried worked. I am not very knowledgeable in computer networking stuff beyond the basics, so I am lost here.Something I must say is that opening sockets via the Rust standard library and Tokio does work for me. For example, this code runs completely fine:
Thus, there is something specific to the way hickory-client handles the socket connections that my SO is complaining about.
I don't think I follow when you say "You could try setting up a tracing subscriber and enabling it with
RUST_LOG=trace", I am sorry. I am kind of new to Rust programming, and I still have a lot to learn. I did run the code withRUST_BACKTRACE=1, though, but it provided no more useful information about the problem.@djc commented on GitHub (Jun 14, 2025):
Put this code at the beginning of
main()and invoke the binary withRUST_LOG=trace:@0xb01u commented on GitHub (Jun 14, 2025):
Thank you very much for the assistance. I really appreciate it.
Here is the new output:
For reference, this is the output I get on my system that works:
So it seems the UDP socket itself is created successfully, but then it fails before creating the UDP receive buffer in
udp_client_stream, right?@djc commented on GitHub (Jun 16, 2025):
I think that means the error is coming from here:
https://github.com/hickory-dns/hickory-dns/blob/main/crates/proto/src/udp/udp_client_stream.rs#L280
https://linux.die.net/man/2/sendto says:
@divergentdave commented on GitHub (Jun 16, 2025):
Since the error is coming from an EPERM error code, I think it's likely the problem is due to apparmor, seccomp BPF, or similar blocking a system call. Running the example under
stracecould confirm whether thesendtosyscall is the one being blocked, or if it's something else.@0xb01u commented on GitHub (Jun 17, 2025):
Oh, I forgot about the existence of
strace. Sorry about that.I can confirm the
sendtosyscall is the one being blocked:(Note that I ran the program as superuser.)
Can I solve this by any means? (I'm kinda lost here.) Would it make sense to add logic to
udp_client_stream.rsto detect the issue and return a more meaningful error message?I am searching on the Internet for possible solutions to this (i.e. Googling "sendto udp syscall operation not permitted"), I've already tried a bunch of suggested solutions, but, still, nothing is working. The only thing I've got so far is that it may be a bug with some versions of Ubuntu.
@0xb01u commented on GitHub (Jun 23, 2025):
I found the cause of the issue.
I was using a VPN in my first system, and none in the second. The VPN I was using blocks any connection performed outside of the VPN tunnel, so that must be messing with the
sendtosyscall.It is strange how some communications are allowed but others are not. Maybe that's why I didn't realize the VPN could have something to do with it from the beginning.
Disconnecting from the VPN seems to solve the issue. It might not be the best solution, but it is a solution.