Skip to content

Conversation

@lstipakov
Copy link
Member

No description provided.

Introduce a new IOCTL (OVPN_IOCTL_GET_PEER_STATS) to retrieve per-peer
link and VPN byte counters, useful in multipeer mode.

Two usage modes are supported:

 - Single peer: userspace passes a peer ID and a fixed-size output
   buffer to receive statistics for that peer only.

 - All peers: userspace first calls the IOCTL with a small output
   buffer to obtain the required buffer size, then calls again with an
   allocated buffer large enough to hold stats for all peers.

Implementation details:

- Added OVPN_PEER_STATS and OVPN_GET_PEER_STATS structs to UAPI.

- Added OvpnPeerGetStatsV2() handler in driver.

- Updated RX/TX paths to track LinkRx/TxBytes and VpnRx/TxBytes
in OvpnPeerContext using atomic operations.

- Wired the new handler into OvpnEvtIoDeviceControl().

GitHub: OpenVPN#121

Signed-off-by: Lev Stipakov <[email protected]>
Also switch to C++20.

Signed-off-by: Lev Stipakov <[email protected]>
Signed-off-by: Lev Stipakov <[email protected]>
@lstipakov lstipakov merged commit acda2df into OpenVPN:multipeer Aug 12, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant