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

multi: don't call DCO APIs if DCO is disabled

The agreement with the DCO submodule is that no API should be called if
DCO is actually disabled. For this reason, every invocation must happen
only after having checked that dco_enabled() returns true.

Add missing checks before invoking dco_get_peer_stats_multi()

Reported-by: Lev Stipakov <lev@openvpn.net>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20230321102842.10780-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26458.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Antonio Quartulli 2023-03-21 11:28:42 +01:00 committed by Gert Doering
parent daf66f4013
commit 891c71db5e

View File

@ -549,7 +549,10 @@ multi_del_iroutes(struct multi_context *m,
static void
setenv_stats(struct multi_context *m, struct context *c)
{
dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m);
if (dco_enabled(&m->top.options))
{
dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m);
}
setenv_counter(c->c2.es, "bytes_received", c->c2.link_read_bytes + c->c2.dco_read_bytes);
setenv_counter(c->c2.es, "bytes_sent", c->c2.link_write_bytes + c->c2.dco_write_bytes);
@ -849,7 +852,10 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int
status_reset(so);
dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m);
if (dco_enabled(&m->top.options))
{
dco_get_peer_stats_multi(&m->top.c1.tuntap->dco, m);
}
if (version == 1)
{