[Openvpn-devel,XS] Change in openvpn[release/2.6]: Fix '--inactive <time> 0' behavior for DCO

Message ID 1a52c029c8ef766594ac07d8a450dd12aff11fee-HTML@gerrit.openvpn.net
State Not Applicable
Headers show
Series [Openvpn-devel,XS] Change in openvpn[release/2.6]: Fix '--inactive <time> 0' behavior for DCO | expand

Commit Message

flichtenheld (Code Review) July 17, 2023, 2:17 p.m. UTC
stipa has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/201?usp=email )


Change subject: Fix '--inactive <time> 0' behavior for DCO
......................................................................

Fix '--inactive <time> 0' behavior for DCO

Make sure we exit if <bytes> is 0 (not set) and no traffic
was produced.

According to man page and non-DCO --inactive implementation,
we exit if amount of bytes produced is less than <bytes> specified.
DCO implementation will do off-by-ones, but we consider it as okay
since we don't want to complicate code to handle both bytes=0 and >0
cases.

Change-Id: I4c089e486728a43bfe42596787c00355838311da
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20230322113408.2057-1-lstipakov@gmail.com>
URL: https://www.mail-archive.com/search?l=mid&q=20230322113408.2057-1-lstipakov@gmail.com
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6c64b46b15476351ca19f9a8f3cb8185aa2c7e07)
---
M src/openvpn/forward.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/01/201/2

Patch

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 28a96f9..b3e0ba5 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -481,7 +481,7 @@ 
         int64_t tot_bytes = c->c2.tun_read_bytes + c->c2.tun_write_bytes;
         int64_t new_bytes = tot_bytes - c->c2.inactivity_bytes;
 
-        if (new_bytes >= c->options.inactivity_minimum_bytes)
+        if (new_bytes > c->options.inactivity_minimum_bytes)
         {
             c->c2.inactivity_bytes = tot_bytes;
             event_timeout_reset(&c->c2.inactivity_interval);