summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-11-05 16:27:55 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-14 23:12:22 +0100
commit49ef064c8dcd8ed12d98e6c705e676babade0897 (patch)
treedabc1284d3ab84209bab5b0f2eef29de4e38e308 /src/resolve/resolved-bus.c
parentresolved: refuse packets looped back to us (diff)
downloadsystemd-49ef064c8dcd8ed12d98e6c705e676babade0897.tar.xz
systemd-49ef064c8dcd8ed12d98e6c705e676babade0897.zip
resolved: refuse sending packets to our own stub listeners
A previous commit made sure that when one of our own packets is looped back to us, we ignore it. But let's go one step further, and refuse operation if we notice the server we talk to is our own. This way we won't generate unnecessary traffic and can return a cleaner error. Fixes: #17413
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r--src/resolve/resolved-bus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 6db8261ac0..0c1124f7dd 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -104,6 +104,9 @@ static int reply_query_state(DnsQuery *q) {
case DNS_TRANSACTION_NO_SOURCE:
return sd_bus_reply_method_errorf(q->bus_request, BUS_ERROR_NO_SOURCE, "All suitable resolution sources turned off");
+ case DNS_TRANSACTION_STUB_LOOP:
+ return sd_bus_reply_method_errorf(q->bus_request, BUS_ERROR_STUB_LOOP, "Configured DNS server loops back to us");
+
case DNS_TRANSACTION_RCODE_FAILURE: {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;