summaryrefslogtreecommitdiff
path: root/src/nss-resolve
diff options
context:
space:
mode:
authorott <ott@users.noreply.github.com>2018-01-23 01:53:31 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-01-23 09:53:31 +0900
commit4cbfd62b46e3fb93309a43741d90e52c9cbb2451 (patch)
tree1d5e04aefe91307bac55df8e7a85e4fe67f7f652 /src/nss-resolve
parent47628ee121376ec07c50f864dd75aae86f119a45 (diff)
downloadsystemd-4cbfd62b46e3fb93309a43741d90e52c9cbb2451.tar.gz
resolve: Adjust and unify D-Bus call timeout (#7847)
DNS queries have a timeout of DNS_TRANSACTION_ATTEMPTS_MAX * DNS_TIMEOUT_MAX_USEC = 120 s. Calls to the ResolveHostname method of the org.freedesktop.resolve1.Manager interface have various call timeouts that are smaller than 120 s. So it seems correct to adjust the call timeout to the maximum query timeout and to unify the call timeout among all callers. A timeout of 120 s might seem large, in particular since BIND does seem to have a query timeout of 10 s. However, it seems match the timeout value of 120 s of Unbound. Moreover, the query and timeout handling of resolve have problems and might be improved in the future, so this change is at best an interim solution.
Diffstat (limited to 'src/nss-resolve')
-rw-r--r--src/nss-resolve/nss-resolve.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index cab3c22bb2..fe6ce4cbbf 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -30,6 +30,7 @@
#include "in-addr-util.h"
#include "macro.h"
#include "nss-util.h"
+#include "resolved-def.h"
#include "string-util.h"
#include "util.h"
#include "signal-util.h"
@@ -37,8 +38,6 @@
NSS_GETHOSTBYNAME_PROTOTYPES(resolve);
NSS_GETHOSTBYADDR_PROTOTYPES(resolve);
-#define DNS_CALL_TIMEOUT_USEC (45*USEC_PER_SEC)
-
static bool bus_error_shall_fallback(sd_bus_error *e) {
return sd_bus_error_has_name(e, SD_BUS_ERROR_SERVICE_UNKNOWN) ||
sd_bus_error_has_name(e, SD_BUS_ERROR_NAME_HAS_NO_OWNER) ||
@@ -157,7 +156,7 @@ enum nss_status _nss_resolve_gethostbyname4_r(
if (r < 0)
goto fail;
- r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ r = sd_bus_call(bus, req, SD_RESOLVED_QUERY_TIMEOUT_USEC, &error, &reply);
if (r < 0) {
if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
*errnop = ESRCH;
@@ -335,7 +334,7 @@ enum nss_status _nss_resolve_gethostbyname3_r(
if (r < 0)
goto fail;
- r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ r = sd_bus_call(bus, req, SD_RESOLVED_QUERY_TIMEOUT_USEC, &error, &reply);
if (r < 0) {
if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
*errnop = ESRCH;
@@ -533,7 +532,7 @@ enum nss_status _nss_resolve_gethostbyaddr2_r(
if (r < 0)
goto fail;
- r = sd_bus_call(bus, req, DNS_CALL_TIMEOUT_USEC, &error, &reply);
+ r = sd_bus_call(bus, req, SD_RESOLVED_QUERY_TIMEOUT_USEC, &error, &reply);
if (r < 0) {
if (sd_bus_error_has_name(&error, _BUS_ERROR_DNS "NXDOMAIN")) {
*errnop = ESRCH;