Hi,
On 15/12/2022 10:31, Lev Stipakov wrote:
Hi,
In non-dco use, the stats as persisted by the management interface are not reset throughout
the lifetime of the process. With dco, what the driver provides is "Peer Stats"
which is reset in OvpnPeerNew() (linux appears to do the same). A quick option > would
be to move the zero-ing to OvpnEvtFileCleanup() which, I guess, would work at least when
persist-tun is in use.
Yeah, without persist-tun client closes the handle, which triggers
OvpnEvtFileCleanup(), which would reset stats.
Or in a new callback that gets called on tun-open. But then it wont be strictly
"Peer Stats".
Yeah that might be an option, to have RESET_STATS ioctl.
Also I wonder if the driver could remember, say, the last pid, and
then reset stats on NEW_PEER if pid != last pid. Since pids are
recycled, we might "leak" stats in unfortunate cases, but that's okay
I guess?
Sorry for jumping in the discussion a bit late.
IMHO the stats belong to the Peer object.
Let's not forget that, apart from windows, DCO supports multi-peer mode,
therefore we have to consider that case as well.
Due to the above, I'd "reset" the stats when a new peer object is
instantiated. Basically when a new peer object is instantiated it should
come with empty stats, as expected.
If the desired behvaiour in userspace is to keep the stats persistent
across a number of events, it should simply be userspace to keep those
stats.
This way we don't mix up the logic of counting the bytes per peer, and
keeping a general picture of the VPN process.
Cheers,
--
Antonio Quartulli
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel