Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-13 Thread Antonio Quartulli
Hi, On 05/12/2022 17:41, Kristof Provost via Openvpn-devel wrote: From: Kristof Provost When DCO is active userspace doesn't see all of the traffic, so when we access these stats we must update them. Retrieve kernel statistics every time we access the link_(read|write)_bytes values.

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-13 Thread Gert Doering
Hi, On Tue, Dec 13, 2022 at 01:12:30PM +0100, Antonio Quartulli wrote: > Ideally a GET_PEER command is pretty standard and can also be used for > any kind of state inspection (i.e. even for 'debugging', although it's > not the primary usage) [..] > Like I said above, being this an API imho it

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-13 Thread Antonio Quartulli
Hi, On 13/12/2022 05:46, Gert Doering wrote: Hi, On Mon, Dec 12, 2022 at 09:53:36PM +0100, Antonio Quartulli wrote: On 05/12/2022 17:41, Kristof Provost via Openvpn-devel wrote: [cut] +int +dco_get_peer_stats(dco_context_t *dco, struct multi_context *m) +{ + +struct ifdrv drv; +

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Gert Doering
Hi, On Mon, Dec 12, 2022 at 09:53:36PM +0100, Antonio Quartulli wrote: > On 05/12/2022 17:41, Kristof Provost via Openvpn-devel wrote: > [cut] > > +int > > +dco_get_peer_stats(dco_context_t *dco, struct multi_context *m) > > +{ > > + > > +struct ifdrv drv; > > +uint8_t buf[4096]; > > +

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Antonio Quartulli
Hi, On 05/12/2022 17:41, Kristof Provost via Openvpn-devel wrote: [cut] + +int +dco_get_peer_stats(dco_context_t *dco, struct multi_context *m) +{ + +struct ifdrv drv; +uint8_t buf[4096]; +nvlist_t *nvl; +const nvlist_t *const *nvpeers; +size_t npeers; +int ret; + +

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Arne Schwabe
Am 12.12.22 um 14:30 schrieb Gert Doering: Hi, On Mon, Dec 12, 2022 at 01:50:51PM +0100, Arne Schwabe wrote: I am not too much into FreeBSD parts, but +hash_iterator_init(m->hash, ); + +while ((he = hash_iterator_next())) +{ +struct multi_instance *mi = (struct

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Gert Doering
Hi, On Mon, Dec 12, 2022 at 01:50:51PM +0100, Arne Schwabe wrote: > > I am not too much into FreeBSD parts, but > > > >> +hash_iterator_init(m->hash, ); > >> + > >> +while ((he = hash_iterator_next())) > >> +{ > >> +struct multi_instance *mi = (struct multi_instance *)

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Arne Schwabe
Am 12.12.22 um 13:34 schrieb Lev Stipakov: Hi, This is good - I need an API to get stats to make openvpn-gui show those (via the management interface). I am not too much into FreeBSD parts, but +hash_iterator_init(m->hash, ); + +while ((he = hash_iterator_next())) +{ +

Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel

2022-12-12 Thread Lev Stipakov
Hi, This is good - I need an API to get stats to make openvpn-gui show those (via the management interface). I am not too much into FreeBSD parts, but > +hash_iterator_init(m->hash, ); > + > +while ((he = hash_iterator_next())) > +{ > +struct multi_instance *mi = (struct