aboutsummaryrefslogtreecommitdiff
path: root/src/openvpn/options.h
diff options
context:
space:
mode:
authorGert Doering2022-02-04 12:42:01 +0100
committerGert Doering2022-02-04 14:10:53 +0100
commitcae1a7fcf14e6ded34ab5a1e8842c3034cc89608 (patch)
tree31b1ff3f26b255a89d6879d41aea4335634f0a0b /src/openvpn/options.h
parent2914444e7cd514eb03e6cd7949e5219557710ae8 (diff)
downloadopenvpn-cae1a7fcf14e6ded34ab5a1e8842c3034cc89608.zip
openvpn-cae1a7fcf14e6ded34ab5a1e8842c3034cc89608.tar.gz
Repair --inactive with 'bytes' argument larger 2Gbytes.
--inactive has an optional 2nd parameter specifiying the number of bytes that need to be sent/received in the given time window. This was parsed with atoi(), stored in an 32bit int. atoi() overflows at 2Gbyte (signed int), which makes gcc return "0" and MSVC "2^31-1" for the value reported in the ticket (10G) - so on gcc, this was behaving like "not set", while windows builds after 2.5.4 honoured this setting, and aborted (unexpectedly) due to "not enough traffic". Fix by increasing word length of all involved variables to int64_t. While add it, add option printer SHOW_LONG(), and print variable. This has the potential to break existing setups where this value is set unreasonably high, thus "impossible to achieve in the interval", but which was never noticed before due to "overflow, 0, ignored". Thus, print WARNING if a value >INT_MAX (2Gbyte) is configured. v2: use atoll(), as atol() is limited to INT_MAX on MSVC, and PRi64 for format string. Rename SHOW_LONG() to SHOW_INT64(). Trac: #1448 Signed-off-by: Gert Doering <gert@greenie.muc.de> Acked-by: Lev Stipakov <lstipakov@gmail.com> Message-Id: <20220204114201.5632-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg23720.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/openvpn/options.h')
-rw-r--r--src/openvpn/options.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index c252339..13d6b0d 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -304,7 +304,7 @@ struct options
int keepalive_timeout;
int inactivity_timeout; /* --inactive */
- int inactivity_minimum_bytes;
+ int64_t inactivity_minimum_bytes;
int ping_send_timeout; /* Send a TCP/UDP ping to remote every n seconds */
int ping_rec_timeout; /* Expect a TCP/UDP ping from remote at least once every n seconds */