Commit
bf01a96 introduced a bug in the dco-freebsd path by attempting to
store peer statistics in a structure that only exists on server
instances. This leads to a SIGSEGV on non-server instances due to a NULL
multi_context pointer.
Resolve this by checking what mode the current instance is running in
and storing peer stats accordingly.
Fixes: https://github.com/OpenVPN/openvpn/issues/875
Change-Id: I92b5f3996f2a2180fa5e94719603078c1fc2f7f6
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1290
Message-Id: <
20251028113310.19921-1-gert@greenie.muc.de>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
if (nvlist_exists_nvlist(nvl, "bytes"))
{
- dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_id, nvlist_get_nvlist(nvl, "bytes"));
+ const nvlist_t *bytes = nvlist_get_nvlist(nvl, "bytes");
+
+ if (dco->c->mode == CM_TOP)
+ {
+ dco_update_peer_stat(dco->c->multi, dco->dco_message_peer_id, bytes);
+ }
+ else
+ {
+ dco->c->c2.dco_read_bytes = nvlist_get_number(bytes, "in");
+ dco->c->c2.dco_write_bytes = nvlist_get_number(bytes, "out");
+ }
}
dco->dco_message_type = OVPN_CMD_DEL_PEER;