0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

Persist DCO client data channel traffic stats on restart

Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20221215232104.1181936-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25742.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Selva Nair 2022-12-15 18:21:04 -05:00 committed by Gert Doering
parent f778f4f88e
commit 0fdbb288db
5 changed files with 31 additions and 0 deletions

View File

@ -4165,6 +4165,17 @@ uninit_management_callback(void)
#endif #endif
} }
void
persist_client_stats(struct context *c)
{
#ifdef ENABLE_MANAGEMENT
if (management)
{
man_persist_client_stats(management, c);
}
#endif
}
/* /*
* Initialize a tunnel instance, handle pre and post-init * Initialize a tunnel instance, handle pre and post-init
* signal settings. * signal settings.

View File

@ -147,4 +147,6 @@ void write_pid_file(const char *filename, const char *chroot_dir);
void remove_pid_file(void); void remove_pid_file(void);
void persist_client_stats(struct context *c);
#endif /* ifndef INIT_H */ #endif /* ifndef INIT_H */

View File

@ -4068,6 +4068,19 @@ management_check_bytecount(struct context *c, struct management *man, struct tim
} }
} }
/* DCO resets stats on reconnect. Since client expects stats
* to be preserved across reconnects, we need to save DCO
* stats before tearing the tunnel down.
*/
void
man_persist_client_stats(struct management *man, struct context *c)
{
if (dco_enabled(&c->options) && (dco_get_peer_stats(c) == 0))
{
management_bytes_client(man, c->c2.dco_read_bytes, c->c2.dco_write_bytes);
}
}
#else /* ifdef ENABLE_MANAGEMENT */ #else /* ifdef ENABLE_MANAGEMENT */
void void

View File

@ -548,6 +548,9 @@ management_bytes_server(struct management *man,
} }
} }
void
man_persist_client_stats(struct management *man, struct context *c);
#endif /* ifdef ENABLE_MANAGEMENT */ #endif /* ifdef ENABLE_MANAGEMENT */
/** /**

View File

@ -97,6 +97,8 @@ tunnel_point_to_point(struct context *c)
perf_pop(); perf_pop();
} }
persist_client_stats(c);
uninit_management_callback(); uninit_management_callback();
/* tear down tunnel instance (unless --persist-tun) */ /* tear down tunnel instance (unless --persist-tun) */