Change in openvpn[master]: pass link_socket object to i/o functions
A message that is not in the archive (sent off-list or not yet received): gerrit.1700055887000.Id2e06723003a78ee237f0542aa1ab0cb3734e37b@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/431?usp=email
to review the following change.
Change subject: pass link_socket object to i/o functions
......................................................................
pass link_socket object to i/o functions
In order to prepare the code to work with distinct sockets, it is essential that i/o functions do not operate on any hard-coded socket object (i.e. c->c2.link_socket).
This patch changes all the low-level i/o functionis to work with a socket specified as argument rather than a fixed one.
---
M src/openvpn/event.h
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/mtcp.c
M src/openvpn/mudp.c
M src/openvpn/multi.h
M src/openvpn/openvpn.c
M src/openvpn/socket.c
8 files changed, 44 insertions(+), 36 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/31/431/1
src/openvpn/event.h +1 -0
@@ -137,6 +137,7 @@event_arg_t type;union {struct multi_instance *mi;/* if type = EVENT_ARG_MULTI_INSTANCE */ +struct link_socket *ls;/* if type = EVENT_ARG_LINK_SOCKET */ } u; };
src/openvpn/forward.c +27 -24
160 lines not on this page · raw message
src/openvpn/forward.h +10 -7
@@ -72,7 +72,8 @@void pre_select (struct context *c); -void process_io (struct context *c); +void process_io (struct context *ci,struct link_socket *ls); +/**********************************************************************/ /**
@@ -128,10 +129,11 @@* context associated with the appropriate VPN tunnel for which data is * available to be read. * -* @param c - The context structure which contains the external -* network socket from which to read incoming packets. +* @param c The context structure which contains the external +* network socket from which to read incoming packets. +* @param ls The socket where the packet can be read from. */ -void read_incoming_link (struct context *c); +void read_incoming_link (struct context *c,struct link_socket *ls);/** * Starts processing a packet read from the external network interface.
@@ -197,10 +199,11 @@* * If an error occurs, it is logged and the packet is dropped. * -* @param c - The context structure of the VPN tunnel associated with the -* packet. +* @param c The context structure of the VPN tunnel associated with the +* packet. +* @param ls The socket to be used to send the packet. */ -void process_outgoing_link (struct context *c); +void process_outgoing_link (struct context *c,struct link_socket *ls);/**************************************************************************/
src/openvpn/mtcp.c +1 -1
@@ -485,7 +485,7 @@ASSERT (mi);ASSERT (mi->context.c2.link_socket);set_prefix (mi); -read_incoming_link (&mi->context); +read_incoming_link (&mi->context, mi->context.c2.link_socket);clear_prefix ();if (!IS_SIG (&mi->context)) {
src/openvpn/mudp.c +2 -2
@@ -317,7 +317,7 @@msg_set_prefix ("Connection Attempt" ); m->top.c2.to_link = m->hmac_reply; m->top.c2.to_link_addr = m->hmac_reply_dest; -process_outgoing_link (&m->top); +process_outgoing_link (&m->top, &m->top.c2.link_socket[0 ]); m->hmac_reply_dest =NULL ; } }
@@ -380,7 +380,7 @@/* Incoming data on UDP port */ else if (status & SOCKET_READ) { -read_incoming_link (&m->top); +read_incoming_link (&m->top, m->top.c2.link_socket);if (!IS_SIG (&m->top)) {multi_process_incoming_link (m,NULL , mpp_flags);
src/openvpn/multi.h +1 -1
@@ -678,7 +678,7 @@ {bool ret = true;set_prefix (mi); -process_outgoing_link (&mi->context); +process_outgoing_link (&mi->context, mi->context.c2.link_socket); ret =multi_process_post (m, mi, mpp_flags);clear_prefix ();return ret;
src/openvpn/openvpn.c +1 -1
@@ -89,7 +89,7 @@ }/* process the I/O which triggered select */ -process_io (c); +process_io (c, c->c2.link_socket);P2P_CHECK_SIG ();perf_pop ();
src/openvpn/socket.c +1 -0
@@ -1828,6 +1828,7 @@ sock->sd =SOCKET_UNDEFINED ; sock->ctrl_sd =SOCKET_UNDEFINED ; sock->ev_arg.type =EVENT_ARG_LINK_SOCKET ; + sock->ev_arg.u.ls = sock;return sock; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/431?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: Id2e06723003a78ee237f0542aa1ab0cb3734e37b
Gerrit-Change-Number: 431
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
ordex has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/431?usp=email )
Change subject: pass link_socket object to i/o functions
......................................................................
Abandoned
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/431?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: Id2e06723003a78ee237f0542aa1ab0cb3734e37b
Gerrit-Change-Number: 431
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon
ordex has restored this change. ( http://gerrit.openvpn.net/c/openvpn/+/431?usp=email )
Change subject: pass link_socket object to i/o functions
......................................................................
Restored
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/431?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: Id2e06723003a78ee237f0542aa1ab0cb3734e37b
Gerrit-Change-Number: 431
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: restore
ordex has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/431?usp=email )
Change subject: pass link_socket object to i/o functions
......................................................................
Abandoned
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/431?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: Id2e06723003a78ee237f0542aa1ab0cb3734e37b
Gerrit-Change-Number: 431
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon