]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
wireguard: fix exponential backoff when resolving hosts
authorJörg Thalheim <joerg@thalheim.io>
Thu, 28 Mar 2019 16:20:52 +0000 (16:20 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Mar 2019 19:00:19 +0000 (20:00 +0100)
It should stop at 25s, not start.
Fixes #12134

src/network/netdev/wireguard.c

index 03eaac1f9cba59026fa1bf3eca52558dec27d766..5d9df16349c85228f0fb8c7928f3f3923f65d21c 100644 (file)
@@ -322,7 +322,7 @@ static int on_resolve_retry(sd_event_source *s, usec_t usec, void *userdata) {
  * increasing time in milliseconds to wait starting at 200ms and capped at 25 seconds.
  */
 static int exponential_backoff_milliseconds(unsigned n_retries) {
-        return (2 << MAX(n_retries, 7U)) * 100 * USEC_PER_MSEC;
+        return (2 << MIN(n_retries, 7U)) * 100 * USEC_PER_MSEC;
 }
 
 static int wireguard_resolve_handler(sd_resolve_query *q,