From 2778dc25599d99740ca6a3b319c3591f7d868e3f Mon Sep 17 00:00:00 2001 From: job Date: Mon, 8 Aug 2022 15:22:31 +0000 Subject: [PATCH] Unify the maximum idle IO timeout for RSYNC & HTTPS OK claudio@ --- usr.sbin/rpki-client/extern.h | 5 ++++- usr.sbin/rpki-client/http.c | 5 ++--- usr.sbin/rpki-client/rsync.c | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index 611632db15a..58a584239f6 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.144 2022/08/08 14:10:10 job Exp $ */ +/* $OpenBSD: extern.h,v 1.145 2022/08/08 15:22:31 job Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -730,6 +730,9 @@ int mkpathat(int, const char *); /* How many seconds to wait for a connection to succeed. */ #define MAX_CONTIMEOUT 15 +/* How long to wait for IO from a remote server. */ +#define MAX_IO_TIMEOUT 180 + /* Maximum allowd repositories per tal */ #define MAX_REPO_PER_TAL 1000 diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index f5339afcb36..d55482e8eb2 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.62 2022/05/24 09:22:45 claudio Exp $ */ +/* $OpenBSD: http.c,v 1.63 2022/08/08 15:22:31 job Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -70,7 +70,6 @@ #define HTTP_USER_AGENT "OpenBSD rpki-client" #define HTTP_BUF_SIZE (32 * 1024) #define HTTP_IDLE_TIMEOUT 10 -#define HTTP_IO_TIMEOUT (3 * 60) #define MAX_CONTENTLEN (2 * 1024 * 1024 * 1024LL) #define NPFDS (MAX_HTTP_REQUESTS + 1) @@ -1814,7 +1813,7 @@ proc_http(char *bind_addr, int fd) errx(1, "too many connections"); if (conn->io_time == 0) - conn->io_time = now + HTTP_IO_TIMEOUT; + conn->io_time = now + MAX_IO_TIMEOUT; if (conn->io_time <= now) timeout = 0; diff --git a/usr.sbin/rpki-client/rsync.c b/usr.sbin/rpki-client/rsync.c index 996d48129c9..5139e516a07 100644 --- a/usr.sbin/rpki-client/rsync.c +++ b/usr.sbin/rpki-client/rsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsync.c,v 1.39 2022/08/08 14:10:10 job Exp $ */ +/* $OpenBSD: rsync.c,v 1.40 2022/08/08 15:22:31 job Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -313,7 +313,7 @@ proc_rsync(char *prog, char *bind_addr, int fd) args[i++] = "--no-motd"; args[i++] = "--max-size=" STRINGIFY(MAX_FILE_SIZE); args[i++] = "--contimeout=" STRINGIFY(MAX_CONTIMEOUT); - args[i++] = "--timeout=180"; + args[i++] = "--timeout=" STRINGIFY(MAX_IO_TIMEOUT); args[i++] = "--include=*/"; args[i++] = "--include=*.cer"; args[i++] = "--include=*.crl"; -- 2.20.1