* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
@ 2024-09-23 13:41 ` its_Giaan (Code Review)
2024-09-25 11:34 ` flichtenheld (Code Review)
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-09-23 13:41 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 4866 bytes --]
Attention is currently required from: flichtenheld, ordex, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to review the following change.
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
---
M src/openvpn/forward.c
1 file changed, 12 insertions(+), 14 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/1
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 16b4497..1247ba3 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2050,20 +2050,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = 2; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = 4; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = 6; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2077,7 +2075,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2171,7 +2169,7 @@
* Configure event wait based on socket, tuntap flags.
*/
socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
@@ -2182,7 +2180,7 @@
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2190,7 +2188,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2233,7 +2231,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: flichtenheld <frank@...2641...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-MessageType: newchange
[-- Attachment #2: Type: text/html, Size: 8092 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
2024-09-23 13:41 ` [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t its_Giaan (Code Review)
@ 2024-09-25 11:34 ` flichtenheld (Code Review)
2024-09-25 12:00 ` ordex (Code Review)
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: flichtenheld (Code Review) @ 2024-09-25 11:34 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: plaisthos <arne-openvpn@
[-- Attachment #1: Type: text/plain, Size: 1956 bytes --]
Attention is currently required from: its_Giaan, ordex, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 1: Code-Review-2
(4 comments)
Patchset:
PS1:
This patch does not pass the tests
File src/openvpn/forward.c:
http://gerrit.openvpn.net/c/openvpn/+/759/comment/fd14f418_905c5966 :
PS1, Line 2054: static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */
Why the replacement of the macros here?
http://gerrit.openvpn.net/c/openvpn/+/759/comment/87af5a06_5a0e69af :
PS1, Line 2171:
Probably need to change here as well? This patch does not work, but the followup patch does. I assume it is because you forgot to change this here since you change it to something else in the followup patch.
http://gerrit.openvpn.net/c/openvpn/+/759/comment/9d5f598a_d521d386 :
PS1, Line 2176: dco_shift
Miss here as well?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 11:34:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 3979 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
2024-09-23 13:41 ` [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t its_Giaan (Code Review)
2024-09-25 11:34 ` flichtenheld (Code Review)
@ 2024-09-25 12:00 ` ordex (Code Review)
2024-10-01 15:30 ` its_Giaan (Code Review)
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: ordex (Code Review) @ 2024-09-25 12:00 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: flichtenheld <frank@
[-- Attachment #1: Type: text/plain, Size: 2000 bytes --]
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 1:
(3 comments)
File src/openvpn/forward.c:
http://gerrit.openvpn.net/c/openvpn/+/759/comment/b8b190fc_6d65f800 :
PS1, Line 2054: static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */
> Why the replacement of the macros here?
I think this patch predates the introduction of those macros.
So this assignments need to be changed.
http://gerrit.openvpn.net/c/openvpn/+/759/comment/e513c4d7_f82f90ad :
PS1, Line 2171:
> Probably need to change here as well? This patch does not work, but the followup patch does. […]
the & should not be there.
http://gerrit.openvpn.net/c/openvpn/+/759/comment/b177699b_21cb28af :
PS1, Line 2176: dco_shift
> Miss here as well?
the & should not be there
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: flichtenheld <frank@...2641...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 12:00:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <frank@...2641...>
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 3946 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (2 preceding siblings ...)
2024-09-25 12:00 ` ordex (Code Review)
@ 2024-10-01 15:30 ` its_Giaan (Code Review)
2024-10-01 15:31 ` its_Giaan (Code Review)
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-01 15:30 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5189 bytes --]
Attention is currently required from: flichtenheld, its_Giaan, plaisthos.
Hello flichtenheld, ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to look at the new patch set (#2).
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/2
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: flichtenheld <frank@...2641...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 8648 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (3 preceding siblings ...)
2024-10-01 15:30 ` its_Giaan (Code Review)
@ 2024-10-01 15:31 ` its_Giaan (Code Review)
2024-10-02 16:55 ` flichtenheld (Code Review)
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-01 15:31 UTC (permalink / raw)
Cc: flichtenheld <frank@
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
Attention is currently required from: flichtenheld, ordex, plaisthos.
its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 2:
(3 comments)
File src/openvpn/forward.c:
http://gerrit.openvpn.net/c/openvpn/+/759/comment/54e37e09_433ffd78 :
PS1, Line 2054: static uintptr_t socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */
> I think this patch predates the introduction of those macros. […]
Done
http://gerrit.openvpn.net/c/openvpn/+/759/comment/5b145b31_80e33bef :
PS1, Line 2171:
> the & should not be there.
Done
http://gerrit.openvpn.net/c/openvpn/+/759/comment/d6e4081a_007cb7b8 :
PS1, Line 2176: dco_shift
> the & should not be there
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: flichtenheld <frank@...2641...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-Comment-Date: Tue, 01 Oct 2024 15:31:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <frank@...2641...>
Comment-In-Reply-To: ordex <a@...2181...>
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 3821 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (4 preceding siblings ...)
2024-10-01 15:31 ` its_Giaan (Code Review)
@ 2024-10-02 16:55 ` flichtenheld (Code Review)
2024-10-09 8:14 ` its_Giaan (Code Review)
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: flichtenheld (Code Review) @ 2024-10-02 16:55 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: plaisthos <arne-openvpn@
[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]
Attention is currently required from: its_Giaan, ordex, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 2
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-Comment-Date: Wed, 02 Oct 2024 16:55:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 2192 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (5 preceding siblings ...)
2024-10-02 16:55 ` flichtenheld (Code Review)
@ 2024-10-09 8:14 ` its_Giaan (Code Review)
2024-10-11 12:31 ` [Openvpn-devel] [PATCH v3] " Frank Lichtenheld
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-09 8:14 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5261 bytes --]
Attention is currently required from: its_Giaan, ordex, plaisthos.
Hello flichtenheld, ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to look at the new patch set (#3).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/3
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 3
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 8718 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [PATCH v3] io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (6 preceding siblings ...)
2024-10-09 8:14 ` its_Giaan (Code Review)
@ 2024-10-11 12:31 ` Frank Lichtenheld
2024-10-11 14:07 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Frank Lichtenheld @ 2024-10-11 12:31 UTC (permalink / raw)
To: openvpn-devel; +Cc: Antonio Quartulli <a@
From: Antonio Quartulli <a@...2181...>
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Acked-by: Frank Lichtenheld <frank@...2641...>
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Note that while this is not the first patch in the
"multisocket" series, it does not depend on the previous
ones and can be merged independently.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/759
This mail reflects revision 3 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@...2641...>
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (7 preceding siblings ...)
2024-10-11 12:31 ` [Openvpn-devel] [PATCH v3] " Frank Lichtenheld
@ 2024-10-11 14:07 ` its_Giaan (Code Review)
2024-10-14 12:27 ` [Openvpn-devel] [PATCH v4] " Frank Lichtenheld
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-11 14:07 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5208 bytes --]
Attention is currently required from: its_Giaan, plaisthos.
Hello flichtenheld, ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to look at the new patch set (#4).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/4
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 8625 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [PATCH v4] io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (8 preceding siblings ...)
2024-10-11 14:07 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
@ 2024-10-14 12:27 ` Frank Lichtenheld
2024-10-14 12:32 ` [Openvpn-devel] [S] Change in openvpn[master]: " flichtenheld (Code Review)
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Frank Lichtenheld @ 2024-10-14 12:27 UTC (permalink / raw)
To: openvpn-devel; +Cc: Antonio Quartulli <a@
From: Antonio Quartulli <a@...2181...>
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Same as v3 but I added Signed-off-by for Giaan.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/759
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@...2641...>
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (9 preceding siblings ...)
2024-10-14 12:27 ` [Openvpn-devel] [PATCH v4] " Frank Lichtenheld
@ 2024-10-14 12:32 ` flichtenheld (Code Review)
2024-10-17 14:47 ` its_Giaan (Code Review)
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: flichtenheld (Code Review) @ 2024-10-14 12:32 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: plaisthos <arne-openvpn@
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
Attention is currently required from: its_Giaan, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 4: Code-Review+2
(1 comment)
Patchset:
PS4:
resubmitted v4 with added sign-off for Giaan
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 4
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Comment-Date: Mon, 14 Oct 2024 12:32:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 2498 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (10 preceding siblings ...)
2024-10-14 12:32 ` [Openvpn-devel] [S] Change in openvpn[master]: " flichtenheld (Code Review)
@ 2024-10-17 14:47 ` its_Giaan (Code Review)
2024-10-17 15:38 ` flichtenheld (Code Review)
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-17 14:47 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5492 bytes --]
Attention is currently required from: flichtenheld, its_Giaan, ordex, plaisthos.
Hello flichtenheld, ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/5
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: flichtenheld <frank@...2641...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 9005 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (11 preceding siblings ...)
2024-10-17 14:47 ` its_Giaan (Code Review)
@ 2024-10-17 15:38 ` flichtenheld (Code Review)
2024-10-23 8:42 ` [Openvpn-devel] [PATCH v5] " Gert Doering
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: flichtenheld (Code Review) @ 2024-10-17 15:38 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: plaisthos <arne-openvpn@
[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]
Attention is currently required from: its_Giaan, ordex, plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
Patch Set 5: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: ordex <a@...2181...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-Attention: ordex <a@...2181...>
Gerrit-Comment-Date: Thu, 17 Oct 2024 15:38:09 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
[-- Attachment #2: Type: text/html, Size: 2198 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [PATCH v5] io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (12 preceding siblings ...)
2024-10-17 15:38 ` flichtenheld (Code Review)
@ 2024-10-23 8:42 ` Gert Doering
2024-10-23 14:19 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2024-10-23 11:04 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
` (2 subsequent siblings)
16 siblings, 1 reply; 18+ messages in thread
From: Gert Doering @ 2024-10-23 8:42 UTC (permalink / raw)
To: openvpn-devel
From: Antonio Quartulli <a@...2181...>
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/759
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@...2641...>
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (13 preceding siblings ...)
2024-10-23 8:42 ` [Openvpn-devel] [PATCH v5] " Gert Doering
@ 2024-10-23 11:04 ` its_Giaan (Code Review)
2024-10-23 14:19 ` cron2 (Code Review)
2024-10-23 14:19 ` cron2 (Code Review)
16 siblings, 0 replies; 18+ messages in thread
From: its_Giaan (Code Review) @ 2024-10-23 11:04 UTC (permalink / raw)
To: plaisthos <arne-openvpn@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5269 bytes --]
Attention is currently required from: its_Giaan, plaisthos.
Hello flichtenheld, ordex, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
to look at the new patch set (#6).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/6
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 6
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-Attention: plaisthos <arne-openvpn@...1227...>
Gerrit-Attention: its_Giaan <gianmarco@...2726...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 8697 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [PATCH applied] Re: io_work: convert shift argument to uintptr_t
2024-10-23 8:42 ` [Openvpn-devel] [PATCH v5] " Gert Doering
@ 2024-10-23 14:19 ` Gert Doering
0 siblings, 0 replies; 18+ messages in thread
From: Gert Doering @ 2024-10-23 14:19 UTC (permalink / raw)
To: Antonio Quartulli <a@; +Cc: openvpn-devel
This code really wants improvement later on, which is promised by the
commit message... so I hope for the best.
Tested on the server testbed, and while I wouldn't trust myself to
state "this patch does not break anything", *these* code paths are really
well-excercised there - and the patch does not break anything.
Your patch has been applied to the master branch.
commit 04c34f81be920ce57c0c886c627057cc12453b85
Author: Antonio Quartulli
Date: Wed Oct 23 10:42:08 2024 +0200
io_work: convert shift argument to uintptr_t
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <20241023084208.12317-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29604.html
Signed-off-by: Gert Doering <gert@...1296...>
--
kind regards,
Gert Doering
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (14 preceding siblings ...)
2024-10-23 11:04 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
@ 2024-10-23 14:19 ` cron2 (Code Review)
2024-10-23 14:19 ` cron2 (Code Review)
16 siblings, 0 replies; 18+ messages in thread
From: cron2 (Code Review) @ 2024-10-23 14:19 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: openvpn-devel
[-- Attachment #1: Type: text/plain, Size: 5294 bytes --]
cron2 has uploaded a new patch set (#7) to the change originally created by its_Giaan. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <20241023084208.12317-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29604.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/59/759/7
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 7
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-MessageType: newpatchset
[-- Attachment #2: Type: text/html, Size: 8714 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
` (15 preceding siblings ...)
2024-10-23 14:19 ` cron2 (Code Review)
@ 2024-10-23 14:19 ` cron2 (Code Review)
16 siblings, 0 replies; 18+ messages in thread
From: cron2 (Code Review) @ 2024-10-23 14:19 UTC (permalink / raw)
To: its_Giaan <gianmarco@; +Cc: flichtenheld <frank@
[-- Attachment #1: Type: text/plain, Size: 5072 bytes --]
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/759?usp=email )
Change subject: io_work: convert shift argument to uintptr_t
......................................................................
io_work: convert shift argument to uintptr_t
Instead of passing the shift argument as pointer, pass
directly its integer value. This will allow the code to
distinguish a shift value from a real object pointer,
like we already do in multi_tcp_process_io().
This change will allow us later to pass an event_arg
object as event handler argument instead of a simple
integer value.
Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Signed-off-by: Antonio Quartulli <a@...2181...>
Signed-off-by: Gianmarco De Gregori <gianmarco@...2726...>
Acked-by: Frank Lichtenheld <frank@...2641...>
Message-Id: <20241023084208.12317-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29604.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/forward.c
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 6f279ec..66e5be1 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -2065,20 +2065,18 @@
unsigned int tuntap = 0;
struct event_set_return esr[4];
- /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2)
- * and are added to the shift. Check openvpn.h for more details.
- */
- static int socket_shift = SOCKET_SHIFT;
- static int tun_shift = TUN_SHIFT;
- static int err_shift = ERR_SHIFT;
+ /* These shifts all depend on EVENT_READ and EVENT_WRITE */
+ static uintptr_t socket_shift = SOCKET_SHIFT; /* depends on SOCKET_READ and SOCKET_WRITE */
+ static uintptr_t tun_shift = TUN_SHIFT; /* depends on TUN_READ and TUN_WRITE */
+ static uintptr_t err_shift = ERR_SHIFT; /* depends on ES_ERROR */
#ifdef ENABLE_MANAGEMENT
- static int management_shift = MANAGEMENT_SHIFT;
+ static uintptr_t management_shift = MANAGEMENT_SHIFT; /* depends on MANAGEMENT_READ and MANAGEMENT_WRITE */
#endif
#ifdef ENABLE_ASYNC_PUSH
- static int file_shift = FILE_SHIFT;
+ static uintptr_t file_shift = FILE_SHIFT;
#endif
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- static int dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
+ static uintptr_t dco_shift = DCO_SHIFT; /* Event from DCO linux kernel module */
#endif
/*
@@ -2092,7 +2090,7 @@
*/
if (flags & IOW_WAIT_SIGNAL)
{
- wait_signal(c->c2.event_set, (void *)&err_shift);
+ wait_signal(c->c2.event_set, (void *)err_shift);
}
/*
@@ -2185,19 +2183,19 @@
/*
* Configure event wait based on socket, tuntap flags.
*/
- socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
- tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
+ socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)socket_shift, NULL);
+ tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)tun_shift, NULL);
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
if (socket & EVENT_READ && c->c2.did_open_tun)
{
- dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
+ dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)dco_shift);
}
#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{
- management_socket_set(management, c->c2.event_set, (void *)&management_shift, NULL);
+ management_socket_set(management, c->c2.event_set, (void *)management_shift, NULL);
}
#endif
@@ -2205,7 +2203,7 @@
/* arm inotify watcher */
if (c->options.mode == MODE_SERVER)
{
- event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)&file_shift);
+ event_ctl(c->c2.event_set, c->c2.inotify_fd, EVENT_READ, (void *)file_shift);
}
#endif
@@ -2248,7 +2246,7 @@
for (i = 0; i < status; ++i)
{
const struct event_set_return *e = &esr[i];
- c->c2.event_set_status |= ((e->rwflags & 3) << *((int *)e->arg));
+ c->c2.event_set_status |= ((e->rwflags & 3) << (uintptr_t)e->arg);
}
}
else if (status == 0)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/759?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib583bf17e35b14aed78fd8217b6e71e8c2b78089
Gerrit-Change-Number: 759
Gerrit-PatchSet: 7
Gerrit-Owner: its_Giaan <gianmarco@...2726...>
Gerrit-Reviewer: flichtenheld <frank@...2641...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-MessageType: merged
[-- Attachment #2: Type: text/html, Size: 8468 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
end of thread, other threads:[~2024-10-23 14:19 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <gerrit.1727098847000.Ib583bf17e35b14aed78fd8217b6e71e8c2b78089@...2715...>
2024-09-23 13:41 ` [Openvpn-devel] [S] Change in openvpn[master]: io_work: convert shift argument to uintptr_t its_Giaan (Code Review)
2024-09-25 11:34 ` flichtenheld (Code Review)
2024-09-25 12:00 ` ordex (Code Review)
2024-10-01 15:30 ` its_Giaan (Code Review)
2024-10-01 15:31 ` its_Giaan (Code Review)
2024-10-02 16:55 ` flichtenheld (Code Review)
2024-10-09 8:14 ` its_Giaan (Code Review)
2024-10-11 12:31 ` [Openvpn-devel] [PATCH v3] " Frank Lichtenheld
2024-10-11 14:07 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
2024-10-14 12:27 ` [Openvpn-devel] [PATCH v4] " Frank Lichtenheld
2024-10-14 12:32 ` [Openvpn-devel] [S] Change in openvpn[master]: " flichtenheld (Code Review)
2024-10-17 14:47 ` its_Giaan (Code Review)
2024-10-17 15:38 ` flichtenheld (Code Review)
2024-10-23 8:42 ` [Openvpn-devel] [PATCH v5] " Gert Doering
2024-10-23 14:19 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2024-10-23 11:04 ` [Openvpn-devel] [S] Change in openvpn[master]: " its_Giaan (Code Review)
2024-10-23 14:19 ` cron2 (Code Review)
2024-10-23 14:19 ` cron2 (Code Review)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.