From: "cron2 (Code Review)" Date: Mon, 11 Nov 2024 16:35:25 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="g5OKo5tUMdc="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Change --reneg-bytes and --reneg-packets to 64 bit counters List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --g5OKo5tUMdc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/795?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Change --reneg-bytes and --reneg-packets to 64 bit counters ...................................................................... Change --reneg-bytes and --reneg-packets to 64 bit counters reneg-bytes can currently only specify up to a maximum of 2GB. This makes it even problematic to use without extended counters. Change-Id: I993e7fc5609955d271e74370affc2eea340a1e2d Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20241111094033.16073-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29= 744.html Signed-off-by: Gert Doering --- M src/openvpn/options.c M src/openvpn/options.h M src/openvpn/ssl.c M src/openvpn/ssl_common.h 4 files changed, 24 insertions(+), 10 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/95/795/2 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 1beb0ee..10ee9f6 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2032,8 +2032,8 @@ SHOW_INT(tls_timeout); - SHOW_INT(renegotiate_bytes); - SHOW_INT(renegotiate_packets); + SHOW_INT64(renegotiate_bytes); + SHOW_INT64(renegotiate_packets); SHOW_INT(renegotiate_seconds); SHOW_INT(handshake_window); @@ -9187,12 +9187,26 @@ else if (streq(p[0], "reneg-bytes") && p[1] && !p[2]) { VERIFY_PERMISSION(OPT_P_TLS_PARMS); - options->renegotiate_bytes =3D positive_atoi(p[1]); + char *end; + long long reneg_bytes =3D strtoll(p[1], &end, 10); + if (*end !=3D '\0' || reneg_bytes < 0) + { + msg(msglevel, "--reneg-bytes parameter must be an integer and = >=3D 0"); + goto err; + } + options->renegotiate_bytes =3D reneg_bytes; } else if (streq(p[0], "reneg-pkts") && p[1] && !p[2]) { VERIFY_PERMISSION(OPT_P_TLS_PARMS); - options->renegotiate_packets =3D positive_atoi(p[1]); + char *end; + long long pkt_max =3D strtoll(p[1], &end, 10); + if (*end !=3D '\0' || pkt_max < 0) + { + msg(msglevel, "--reneg-pkts parameter must be an integer and >= =3D 0"); + goto err; + } + options->renegotiate_packets =3D pkt_max; } else if (streq(p[0], "reneg-sec") && p[1] && !p[3]) { diff --git a/src/openvpn/options.h b/src/openvpn/options.h index ee39dbb..6ab92e2 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -626,8 +626,8 @@ int tls_timeout; /* Data channel key renegotiation parameters */ - int renegotiate_bytes; - int renegotiate_packets; + int64_t renegotiate_bytes; + int64_t renegotiate_packets; int renegotiate_seconds; int renegotiate_seconds_min; diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index d44185e..1f8eb1e 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -118,7 +118,7 @@ * May *not* be NULL. */ static void -tls_limit_reneg_bytes(const char *ciphername, int *reneg_bytes) +tls_limit_reneg_bytes(const char *ciphername, int64_t *reneg_bytes) { if (cipher_kt_insecure(ciphername)) { @@ -3028,7 +3028,7 @@ && should_trigger_renegotiation(session, ks)) { msg(D_TLS_DEBUG_LOW, "TLS: soft reset sec=3D%d/%d bytes=3D" counte= r_format - "/%d pkts=3D" counter_format "/%d", + "/%" PRIi64 " pkts=3D" counter_format "/%" PRIi64, (int) (now - ks->established), session->opt->renegotiate_secon= ds, ks->n_bytes, session->opt->renegotiate_bytes, ks->n_packets, session->opt->renegotiate_packets); diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index 5bc2f2a..5840e2d 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -331,8 +331,8 @@ int transition_window; int handshake_window; interval_t packet_timeout; - int renegotiate_bytes; - int renegotiate_packets; + int64_t renegotiate_bytes; + int64_t renegotiate_packets; interval_t renegotiate_seconds; /* cert verification parms */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/795?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I993e7fc5609955d271e74370affc2eea340a1e2d Gerrit-Change-Number: 795 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --g5OKo5tUMdc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #2 to the change originally cr= eated by plaisthos.

View Change

The following approvals got outdated= and were removed: Code-Review+2 by cron2

Change --reneg-bytes and --reneg-packets to 64 bit c=
ounters

reneg-bytes can currently only specify up to a maximum of 2G= B.
This makes it even problematic to use without extended counters.
<= br>Change-Id: I993e7fc5609955d271e74370affc2eea340a1e2d
Signed-off-by: A= rne Schwabe <arne@...1227...>
Acked-by: Gert Doering <gert@...1386...= 296...>
Message-Id: <20241111094033.16073-1-gert@...1296...>URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg2= 9744.html
Signed-off-by: Gert Doering <gert@...1296...>
---
= M src/openvpn/options.c
M src/openvpn/options.h
M src/openvpn/ssl.cM src/openvpn/ssl_common.h
4 files changed, 24 insertions(+), 10 delet= ions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chan=
ges/95/795/2
diff --git a/src/openvpn/options.c b/src/openvpn/optio=
ns.c
index 1beb0ee..10ee9f6 100644
--- a/sr= c/openvpn/options.c
+++ b/src/openvpn/options.c
<= span>@@ -2032,8 +2032,8 @@

SHOW_INT(= tls_timeout);

- SHOW_INT(renegotiate_bytes);
- SHOW_INT(renegotiate_packets);
+ SHOW_INT64(renegotiate_bytes);
+ SHOW_INT64(renegotia= te_packets);
SHOW_INT(renegotiate_seconds);
=
SHOW_INT(handshake_window);
@@= -9187,12 +9187,26 @@
else if (streq(p[0], "reneg= -bytes") && p[1] && !p[2])
{
VERIFY_PERMISSION(OPT_P_TLS_PARMS);
- options->renegotiate_bytes = =3D positive_atoi(p[1]);
+ char *end;
+ long long reneg_bytes =3D strtoll(p[1], &end, 10);+ if (*end !=3D '\= 0' || reneg_bytes < 0)
+ {
+= msg(msglevel, "--reneg-bytes parameter must be an integer = and >=3D 0");
+ goto err;
+ }
+ = options->renegotiate_bytes =3D reneg_bytes;
}
else if (streq(p[0], "reneg-pkts") && p= [1] && !p[2])
{
VERIF= Y_PERMISSION(OPT_P_TLS_PARMS);
- options->renegotiate_packets =3D positive_atoi(p[1]);
+ char *end;
+ long long pkt_= max =3D strtoll(p[1], &end, 10);
+ if (*end !=3D '\0' || pkt_max < 0)
+ {
+ msg(msglevel, "--= reneg-pkts parameter must be an integer and >=3D 0");

+ goto err;

<= span style=3D"color: hsl(120, 100%, 40%);">+ }

+ options->renegotiate_packets = =3D pkt_max;
}
else if (streq(p[0= ], "reneg-sec") && p[1] && !p[3])
{

diff --git a/src/openvpn/options.h b/src/openvpn/op= tions.h
index ee39dbb..6ab92e2 100644
--- a= /src/openvpn/options.h
+++ b/src/openvpn/options.h@@ -626,8 +626,8 @@
int tls_timeout;
/* Data channel key renegotiation parameters = */
- int renegotiate= _bytes;
- int renego= tiate_packets;
+ i= nt64_t renegotiate_bytes;
+ int64_t renegotiate_packets;
int renegotiate= _seconds;
int renegotiate_seconds_min;

diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c
index d44185e..1f8eb1e 100644
--- a/src/openvpn/= ssl.c
+++ b/src/openvpn/ssl.c
@@ -118,7 +11= 8,7 @@
* May *not* be NULL. */
static void
-tls_limit_reneg_bytes(const char *ciphername, int *rene= g_bytes)
+tls_limit_r= eneg_bytes(const char *ciphername, int64_t *reneg_bytes)
{=
if (cipher_kt_insecure(ciphername))
= {
@@ -3028,7 +3028,7 @@
&&= amp; should_trigger_renegotiation(session, ks))
{
msg(D_TLS_DEBUG_LOW, "TLS: soft reset sec=3D%d/%d= bytes=3D" counter_format
- "/%d pkts=3D" counter_format "/%d"= ,
+ "= /%" PRIi64 " pkts=3D" counter_format "/%" PRIi64,<= /span>
(int) (now - ks->established), session->= opt->renegotiate_seconds,
ks->n_bytes, s= ession->opt->renegotiate_bytes,
ks->n= _packets, session->opt->renegotiate_packets);
diff --= git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h
i= ndex 5bc2f2a..5840e2d 100644
--- a/src/openvpn/ssl_common.h=
+++ b/src/openvpn/ssl_common.h
@@ -331,8 += 331,8 @@
int transition_window;
i= nt handshake_window;
interval_t packet_timeout;=
- int renegotiate_bytes;
- int renegotiate_pac= kets;
+ int64_t re= negotiate_bytes;
+ = int64_t renegotiate_packets;
interval_t renegotiate_s= econds;

/* cert verification parms *= /

To view, visit change 795. To unsubscribe,= or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I993e7fc5609955d271e74370aff= c2eea340a1e2d
Gerrit-Change-Number: 795
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: newpatchset
--g5OKo5tUMdc=--