chiark / gitweb /
sd-bus: extend D-Bus authentication timeout considerably (#6813)
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Sep 2017 17:08:26 +0000 (19:08 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 13 Sep 2017 17:08:26 +0000 (19:08 +0200)
As it turns out the authentication phase times out too often than is
good, mostly due to PRNG pools not being populated during boot. Hence,
let's increase the authentication timeout from 25s to 90s, to cover for
that.

(Note that we leave the D-Bus method call timeout at 25s, matching the
reference implementation's value. And if the auth phase managed to
complete then the pools should be populated enough and mehtod calls
shouldn't take needlessly long anymore).

Fixes: #6418
src/libelogind/sd-bus/bus-internal.h
src/libelogind/sd-bus/bus-socket.c

index d2f3aeb75d66506efa7773939c74a59557a0dcd5..57c60a4c014c9099dee26fadc632fbb5f488e322 100644 (file)
@@ -27,6 +27,7 @@
 #include "bus-error.h"
 #include "bus-kernel.h"
 #include "bus-match.h"
+#include "def.h"
 #include "hashmap.h"
 #include "list.h"
 #include "prioq.h"
@@ -316,8 +317,13 @@ struct sd_bus {
         LIST_HEAD(sd_bus_track, tracks);
 };
 
+/* For method calls we time-out at 25s, like in the D-Bus reference implementation */
 #define BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
 
+/* For the authentication phase we grant 90s, to provide extra room during boot, when RNGs and such are not filled up
+ * with enough entropy yet and might delay the boot */
+#define BUS_AUTH_TIMEOUT ((usec_t) DEFAULT_TIMEOUT_USEC)
+
 #define BUS_WQUEUE_MAX (192*1024)
 #define BUS_RQUEUE_MAX (192*1024)
 
index 982af68c016a00ddde284983d468c71f4c42b41c..6e4bd541bffcc791bd4354a433500952c77d9adf 100644 (file)
@@ -660,7 +660,7 @@ int bus_socket_start_auth(sd_bus *b) {
         bus_get_peercred(b);
 
         b->state = BUS_AUTHENTICATING;
-        b->auth_timeout = now(CLOCK_MONOTONIC) + BUS_DEFAULT_TIMEOUT;
+        b->auth_timeout = now(CLOCK_MONOTONIC) + BUS_AUTH_TIMEOUT;
 
         if (sd_is_socket(b->input_fd, AF_UNIX, 0, 0) <= 0)
                 b->hello_flags &= ~KDBUS_HELLO_ACCEPT_FD;