]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
multi: don't call DCO APIs if DCO is disabled
authorAntonio Quartulli <a@unstable.cc>
Tue, 21 Mar 2023 10:28:42 +0000 (11:28 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 21 Mar 2023 15:07:58 +0000 (16:07 +0100)
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>
src/openvpn/multi.c

index 933bf9bc3d6e9705b1ae20d689ec1c9bf0557966..1480bf477ddc39f432ee3f6355e0e49891646cb5 100644 (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)
         {