diff options
author | Joan Bruguera <joanbrugueram@gmail.com> | 2023-02-12 21:06:08 +0100 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-02-15 21:01:39 +0100 |
commit | 3dd6336ad0cb40e928745404ed72c41e4ac9c39e (patch) | |
tree | c3aac7d5c4a92e32e3f79dc4b8546c5fd3d3cae0 /src/resolve/resolved-dns-transaction.c | |
parent | core: add support for Startup memory limits (diff) | |
download | systemd-3dd6336ad0cb40e928745404ed72c41e4ac9c39e.tar.xz systemd-3dd6336ad0cb40e928745404ed72c41e4ac9c39e.zip |
resolved: Fall back to TCP if UDP is blocked
If UDP is blocked on the system (e.g. by iptables or BPF), the kernel will
return EPERM on some or all of the system calls (connect, sendmsg, etc.).
In this case, try to fall back to TCP, which hopefully will not be blocked.
Diffstat (limited to '')
-rw-r--r-- | src/resolve/resolved-dns-transaction.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index 8d76630adb..3f994690e6 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -2079,7 +2079,9 @@ int dns_transaction_go(DnsTransaction *t) { log_debug("Sending query via TCP since it is too large."); else if (r == -EAGAIN) log_debug("Sending query via TCP since UDP isn't supported or DNS-over-TLS is selected."); - if (IN_SET(r, -EMSGSIZE, -EAGAIN)) + else if (r == -EPERM) + log_debug("Sending query via TCP since UDP is blocked."); + if (IN_SET(r, -EMSGSIZE, -EAGAIN, -EPERM)) r = dns_transaction_emit_tcp(t); } if (r == -ELOOP) { |