Date: Mon, 18 Oct 2021 11:07:55 +0300 From: =?UTF-8?B?w5Z6a2FuIEtJUklL?= <ozkan.kirik@gmail.com> To: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net> Cc: FreeBSD Net <freebsd-net@freebsd.org>, freebsd-hackers@freebsd.org Subject: Re: Iterating all VNETs from userspace application Message-ID: <CAAcX-AFr2%2BXOCnW-9ChXBNwG339bT6WUoi0bZHs0Ks1vBt4daA@mail.gmail.com> In-Reply-To: <CAAcX-AE5zgT=LdDQXh_oVVZBcHX6_OYLEk9c6KTdDGLkRgYmmA@mail.gmail.com> References: <CAAcX-AFhdqOdA0%2BfFRvxNJfA%2BXtSJSKqZiXwhq_wKTbiHbeWcg@mail.gmail.com> <E7D358D8-F992-47CA-9A54-3F6A36369D49@lists.zabbadoz.net> <CAAcX-AE5zgT=LdDQXh_oVVZBcHX6_OYLEk9c6KTdDGLkRgYmmA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
I'll have a look On Mon, Oct 18, 2021 at 11:07 AM =C3=96zkan KIRIK <ozkan.kirik@gmail.com> w= rote: > > Thank you Bjoern, I'll have al > > On Mon, Oct 18, 2021 at 10:49 AM Bjoern A. Zeeb > <bzeeb-lists@lists.zabbadoz.net> wrote: > > > > On 18 Oct 2021, at 4:46, =C3=96zkan KIRIK wrote: > > > > > Hi, > > > > > > I'm trying to gather all even within jails/vnet interface stats which > > > interface type ifmd_data.ifi_type =3D=3D IFT_ETHER (6) for bsnmpd. Re= lated > > > function (not modified) is here: > > > > > > https://github.com/freebsd/freebsd-src/blob/main/contrib/bsnmp/snmp_m= ibII/mibII.c#L926-L985 > > > > > > It's possible to add a filter interface type adding a line below line > > > 961: > > > if (mib.ifmd_data.ifi_type !=3D IFT_ETHER) return; > > > > > > I'm looking for a way to iterate VNET instances, but net/vnet.h is > > > only for kernel space. > > > VNET_LIST_RLOCK_NOSLEEP(); > > > VNET_FOREACH(vnet_iter) { > > > CURVNET_SET(vnet_iter); > > > mib_refresh_iflist(); > > > CURVNET_RESTORE(); > > > } > > > VNET_LIST_RUNLOCK_NOSLEEP(); > > > The code above not working in userspace. > > > > > > Also I wonder that if it's possible to switch between jails. The > > > pseudo code I want to write: > > > > > > JAIL_FOREACH(jail_iter) { > > > jail_attach(jail_iter); > > > mib_refresh_iflist(); > > > jail_detach(); > > > } > > > > > > What is the right way to gather all interface stats ? > > > > Have a look at libkvm; I seem to remember adding vnet support. > > > > /bz > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAcX-AFr2%2BXOCnW-9ChXBNwG339bT6WUoi0bZHs0Ks1vBt4daA>