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/+/1157?usp=email

to review the following change.


Change subject: Don't call bytecount client logic in server mode
......................................................................

Don't call bytecount client logic in server mode

Calling this in server mode is wrong because:

 - we only output those counters via management interface
 (>BYTECOUT:) in client mode, so in server mode this is no-op

 - the timer callback to fetch DCO stats is triggerer
 independenty for each peer. It is a waste of resources in server mode
 where we could fetch stats for all peers with the single ioctl.

Change-Id: I7bc7de284fdbfd4be26a907ecd5c21c075bc5ac4
Signed-off-by: Lev Stipakov <l...@openvpn.net>
---
M src/openvpn/forward.c
M src/openvpn/manage.c
M src/openvpn/manage.h
3 files changed, 5 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/57/1157/1

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 75ca9d5..e8bdf35 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -818,7 +818,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 */
 }
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index aed04f5..f057fb2 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -4065,9 +4065,9 @@
 }

 void
-management_check_bytecount(struct context *c, struct management *man, struct 
timeval *timeval)
+management_check_bytecount_client(struct context *c, struct management *man, 
struct timeval *timeval)
 {
-    if (event_timeout_trigger(&man->connection.bytecount_update_interval, 
timeval, ETT_DEFAULT))
+    if (!(man->persist.callback.flags & MCF_SERVER) && 
event_timeout_trigger(&man->connection.bytecount_update_interval, timeval, 
ETT_DEFAULT))
     {
         counter_type dco_read_bytes = 0;
         counter_type dco_write_bytes = 0;
@@ -4083,10 +4083,7 @@
             dco_write_bytes = c->c2.dco_write_bytes;
         }

-        if (!(man->persist.callback.flags & MCF_SERVER))
-        {
-            man_bytecount_output_client(man, dco_read_bytes, dco_write_bytes);
-        }
+        man_bytecount_output_client(man, dco_read_bytes, dco_write_bytes);
     }
 }

diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h
index 083caf5..038691f 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/manage.h
@@ -492,7 +492,7 @@
  * 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)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1157?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: I7bc7de284fdbfd4be26a907ecd5c21c075bc5ac4
Gerrit-Change-Number: 1157
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <lstipa...@gmail.com>
Gerrit-Reviewer: flichtenheld <fr...@lichtenheld.com>
Gerrit-Reviewer: plaisthos <arne-open...@rfc2549.org>
Gerrit-CC: openvpn-devel <openvpn-devel@lists.sourceforge.net>
Gerrit-Attention: plaisthos <arne-open...@rfc2549.org>
Gerrit-Attention: flichtenheld <fr...@lichtenheld.com>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to