Change in openvpn[release/2.6]: Refactor management bytecount tracking
A message that is not in the archive (sent off-list or not yet received): gerrit.1771250081000.I4e1e8a204d1371a314b01737aedaa3d68fe28531@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1532?usp=email
to review the following change.
Change subject: Refactor management bytecount tracking
......................................................................
Refactor management bytecount tracking
There are few issues with it:
- when using DCO, the server part doesn't output BYTECOUNT_CLI since process_incoming_link_part1/process_outgoing_link are not called
- when using DCO, the server part applies bytecount timer to the each connection, unneccessary making too many calls to the kernel and also uses incorect BYTECOUNT output.
- client part outputs counters using timer, server part utilizes traffic activity -> inconsistency
Following changes have been made:
- Use timer to output counters in client and server mode. Code which deals with bytecount on traffic activity has been removed. This unifies DCO and non-DCO, as well as client and server mode
- In server mode, peers stats are fetched with the single ioctl call
- Per-packet stats are not persisted anymore in the client mode during traffic activity. Instead cumulative stats (including DCO stats) are persisted when the session closes.
GitHub: https://github.com/OpenVPN/openvpn/issues/820
---
M src/openvpn/forward.c
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
4 files changed, 77 insertions(+), 77 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/1532/1
src/openvpn/forward.c +1 -15
@@ -824,7 +824,7 @@#ifdef ENABLE_MANAGEMENT if (management) { -management_check_bytecount (c, management, &c->c2.timeval); +management_check_bytecount_client (c, management, &c->c2.timeval); }#endif /* ENABLE_MANAGEMENT */ }
@@ -1006,13 +1006,6 @@ }#endif c->c2.original_recv_size = c->c2.buf.len; -#ifdef ENABLE_MANAGEMENT -if (management) - { -management_bytes_client (management, c->c2.buf.len,0 ); -management_bytes_server (management, &c->c2.link_read_bytes, &c->c2.link_write_bytes, &c->c2.mda_context); - } -#endif }else {
@@ -1852,13 +1845,6 @@ mmap_stats->link_write_bytes = link_write_bytes_global; }#endif -#ifdef ENABLE_MANAGEMENT -if (management) - { -management_bytes_client (management,0 , size); -management_bytes_server (management, &c->c2.link_read_bytes, &c->c2.link_write_bytes, &c->c2.mda_context); - } -#endif } }
src/openvpn/manage.c +67 -26
135 lines not on this page · raw message
src/openvpn/manage.h +2 -36
@@ -70,8 +70,6 @@unsigned int flags;unsigned int mda_key_id_counter; - -time_t bytecount_last_update; };/*
@@ -516,41 +514,9 @@* These functions drive the bytecount in/out counters. */ -void -management_check_bytecount (struct context *c, -struct management *man, -struct timeval *timeval); +void management_check_bytecount_client (struct context *c,struct management *man,struct timeval *timeval); -static inline void -management_bytes_client (struct management *man, -const int size_in, -const int size_out) -{ -if (!(man->persist.callback.flags &MCF_SERVER )) - { - man->persist.bytes_in += size_in; - man->persist.bytes_out += size_out; - } -} - -void -man_bytecount_output_server (const counter_type *bytes_in_total, -const counter_type *bytes_out_total, -struct man_def_auth_context *mdac); - -static inline void -management_bytes_server (struct management *man, -const counter_type *bytes_in_total, -const counter_type *bytes_out_total, -struct man_def_auth_context *mdac) -{ -if (man->connection.bytecount_update_seconds >0 - && now >= mdac->bytecount_last_update + man->connection.bytecount_update_seconds - && (mdac->flags & (DAF_CONNECTION_ESTABLISHED |DAF_CONNECTION_CLOSED )) ==DAF_CONNECTION_ESTABLISHED ) - { -man_bytecount_output_server (bytes_in_total, bytes_out_total, mdac); - } -} +void management_check_bytecount_server (struct multi_context *multi);void man_persist_client_stats (struct management *man,struct context *c);
src/openvpn/multi.c +7 -0
@@ -3840,6 +3840,13 @@ {check_stale_routes (m); } + +#ifdef ENABLE_MANAGEMENT +if (management) + { +management_check_bytecount_server (m); + } +#endif /* ENABLE_MANAGEMENT */ }void
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1532?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I4e1e8a204d1371a314b01737aedaa3d68fe28531
Gerrit-Change-Number: 1532
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>