From: "cron2 (Code Review)" Date: Thu, 30 Oct 2025 18:47:29 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <0633ceb6c439f653b5d2236baae31b75ae8dd99d-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="ZMa3AyjBpME="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: manage: Change kill_by_addr to use better types for port/proto List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld , plaisthos Cc: openvpn-devel --ZMa3AyjBpME= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#4) to the change originally created by= flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1310?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: manage: Change kill_by_addr to use better types for port/pr= oto ...................................................................... manage: Change kill_by_addr to use better types for port/proto Change-Id: I750a0b8107baa77fb14558d0c8e4ef8020d62efd Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1310 Message-Id: <20251030182922.26448-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 054.html Signed-off-by: Gert Doering --- M src/openvpn/manage.c M src/openvpn/manage.h M src/openvpn/multi.c M src/openvpn/socket.h 4 files changed, 8 insertions(+), 8 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1310/4 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 685b137..e46b5f2 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -608,14 +608,14 @@ if (status) { const int port =3D atoi(p3); - const int proto =3D (streq(p1, "tcp")) ? PROTO_TCP_SERVER - : (streq(p1, "udp")) ? PROTO_UDP - : PROTO_NONE; + const uint8_t proto =3D (streq(p1, "tcp")) ? PROTO_TCP_S= ERVER + : (streq(p1, "udp")) ? PROTO_UDP + : PROTO_NONE; - if ((port > 0 && port < 65536) && (proto !=3D PROTO_NONE)) + if ((port > 0 && port < UINT16_MAX) && (proto !=3D PROTO_N= ONE)) { n_killed =3D (*man->persist.callback.kill_by_addr)(man= ->persist.callback.arg, - addr,= port, proto); + addr,= (uint16_t)port, proto); if (n_killed > 0) { msg(M_CLIENT, "SUCCESS: %d client(s) at address %s= :%s:%d killed", n_killed, diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index fe460bf..dedcc15 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -178,7 +178,7 @@ void (*status)(void *arg, const int version, struct status_output *so); void (*show_net)(void *arg, const msglvl_t msglevel); int (*kill_by_cn)(void *arg, const char *common_name); - int (*kill_by_addr)(void *arg, const in_addr_t addr, const int port, c= onst int proto); + int (*kill_by_addr)(void *arg, const in_addr_t addr, const uint16_t po= rt, const uint8_t proto); void (*delete_event)(void *arg, event_t event); int (*n_clients)(void *arg); bool (*send_cc_message)(void *arg, const char *message, const char *pa= rameter); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index e243843..261209d 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3937,7 +3937,7 @@ } static int -management_callback_kill_by_addr(void *arg, const in_addr_t addr, const in= t port, const int proto) +management_callback_kill_by_addr(void *arg, const in_addr_t addr, const ui= nt16_t port, const uint8_t proto) { struct multi_context *m =3D (struct multi_context *)arg; struct hash_iterator hi; diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index e986c9c..832d62e 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -89,7 +89,7 @@ const char *ipchange_command; const struct plugin_list *plugins; bool remote_float; - int proto; /* Protocol (PROTO_x defined below) */ + uint8_t proto; /* Protocol (PROTO_x defined below) */ sa_family_t af; /* Address family like AF_INET, AF_INET6 or AF_UNSPEC= */ bool bind_ipv6_only; int mtu_changed; /* Set to true when mtu value is changed */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1310?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I750a0b8107baa77fb14558d0c8e4ef8020d62efd Gerrit-Change-Number: 1310 Gerrit-PatchSet: 4 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --ZMa3AyjBpME= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #4 to the change originally created by flichtenhel= d.

View Change

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

manage: Change kill_by_addr to use =
better types for port/proto

Change-Id: I750a0b8107baa77fb14558d0c8e4= ef8020d62efd
Signed-off-by: Frank Lichtenheld <frank@...2641...>Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://ger= rit.openvpn.net/c/openvpn/+/1310
Message-Id: <20251030182922.26448-1-= gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1514...= s.sourceforge.net/msg34054.html
Signed-off-by: Gert Doering <gert@...493...= 1296...>
---
M src/openvpn/manage.c
M src/openvpn/manage.h
M= src/openvpn/multi.c
M src/openvpn/socket.h
4 files changed, 8 insert= ions(+), 8 deletions(-)

git pull ssh://gerrit.op=
envpn.net:29418/openvpn refs/changes/10/1310/4
diff --git a/src/ope=
nvpn/manage.c b/src/openvpn/manage.c
index 685b137..e46b5f2= 100644
--- a/src/openvpn/manage.c
+++ b/sr= c/openvpn/manage.c
@@ -608,14 +608,14 @@
= if (status)
{
= const int port =3D atoi(p3);
- const int proto =3D (streq(p1, "tcp= ")) ? PROTO_TCP_SERVER
- : (streq(p1, "udp")) ? = PROTO_UDP
- = : PROTO_NONE;
+ const uint8_t proto = =3D (streq(p1, "tcp")) ? PROTO_TCP_SERVER
+ : (= streq(p1, "udp")) ? PROTO_UDP
+ = : PROTO_NONE;

- if ((port > 0 && port < 65536) = && (proto !=3D PROTO_NONE))
+ if ((port > 0 && port < UINT1= 6_MAX) && (proto !=3D PROTO_NONE))
= {
n_killed =3D (*man->persist.call= back.kill_by_addr)(man->persist.callback.arg,
- = addr, port, proto);
+ = addr, (uint16_t)port, proto);
= if (n_killed > 0)
{ msg(M_CLIENT, "SUCCESS: %d client(s) = at address %s:%s:%d killed", n_killed,
diff --git a/sr= c/openvpn/manage.h b/src/openvpn/manage.h
index fe460bf..de= dcc15 100644
--- a/src/openvpn/manage.h
+++= b/src/openvpn/manage.h
@@ -178,7 +178,7 @@
void (*status)(void *arg, const int version, struct status_output *so= );
void (*show_net)(void *arg, const msglvl_t msglevel= );
int (*kill_by_cn)(void *arg, const char *common_nam= e);
- int (*kill_by_= addr)(void *arg, const in_addr_t addr, const int port, const int proto);
+ int (*kill_by_addr= )(void *arg, const in_addr_t addr, const uint16_t port, const uint8_t proto= );
void (*delete_event)(void *arg, event_t event);
int (*n_clients)(void *arg);
bool (*= send_cc_message)(void *arg, const char *message, const char *parameter);
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c=
index e243843..261209d 100644
--- a/src/openvpn/m= ulti.c
+++ b/src/openvpn/multi.c
@@ -3937,7= +3937,7 @@
}

static in= t
-management_callback_= kill_by_addr(void *arg, const in_addr_t addr, const int port, const int pro= to)
+management_callb= ack_kill_by_addr(void *arg, const in_addr_t addr, const uint16_t port, cons= t uint8_t proto)
{
struct multi_conte= xt *m =3D (struct multi_context *)arg;
struct hash_ite= rator hi;
diff --git a/src/openvpn/socket.h b/src/openvpn/s= ocket.h
index e986c9c..832d62e 100644
--- a= /src/openvpn/socket.h
+++ b/src/openvpn/socket.h
= @@ -89,7 +89,7 @@
const char *ipchange_command;<= /span>
const struct plugin_list *plugins;
= bool remote_float;
- = int proto; /* Protocol (PROTO_x defined below) */
+ uint8_t proto; /* Protocol (PR= OTO_x defined below) */
sa_family_t af; /* Address fa= mily like AF_INET, AF_INET6 or AF_UNSPEC*/
bool bind_i= pv6_only;
int mtu_changed; /* Set to true when mtu val= ue is changed */

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I750a0b8107baa77fb14558d0c8e= 4ef8020d62efd
Gerrit-Change-Number: 1310
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --ZMa3AyjBpME=--