From nobody Mon Oct 18 08:07:55 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EC58C17FBFF0; Mon, 18 Oct 2021 08:08:06 +0000 (UTC) (envelope-from ozkan.kirik@gmail.com) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HXqHp5pblz3kRT; Mon, 18 Oct 2021 08:08:06 +0000 (UTC) (envelope-from ozkan.kirik@gmail.com) Received: by mail-ua1-x931.google.com with SMTP id i15so3410770uap.0; Mon, 18 Oct 2021 01:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+Y+u4tfmgNFW7nNLaMVLXf8DajQkM6LGHBWLAFRXXXQ=; b=CeSO5yoK3SMAwMOWcExp8nc8mzlwtYh+Ps07dtvxBRh67TuU38jmSevImedkPq+B0j CPvvSlWkvYqegRikRhZXbp31Q8T4osEJ+QSP8QsU62epSxGqqz73uQ+p+ICF+DSQmlff ZUYyL7nRJ50QgVcirsuXaXGiE3XT3mquTPNfkDcyd/p3/ae8ayN9uV/PL2u+ndVbcK4R qO+noSQYUfinLe76jfBdy9moRNLq4jFeOEXE0AtcQcx55SBbKrdyzy4eMRKdlunx5IHH ncVljNuBnB97Fhg6sDuHN0sONhv+AVUE1q39vuBSxtR5IZe0Hz4a8oyVeDO4CqhXAyey It6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+Y+u4tfmgNFW7nNLaMVLXf8DajQkM6LGHBWLAFRXXXQ=; b=tR7Ywl6VkGIjovBP+83xBHT1yM/vLt3pYjkWJxncI4bmfK8anlWLh28RaXZ2/0P7F4 Lr9OhRxWeAgbuawClZukaTx735HrLtAwp7i78kB3Jw96v46yBEseTOUoLjImiYCZoBOa L92sOVtu3xmMp6WAtxdVOOX+tNK6ZNMIHDqYt33z/AXYG5kPCcXRuQLUZOg+N4ScWuI5 3U3SAELp+ESZ1/6UNhCILTErk4ANusNUg88CbRX9M/6RgBTdIhKh4B6CjZIhzm02/smN I2xsQdjArXvnNOKrxGkjKLSGfTEUUXgm/W4vxnwZLEbMZ+U1GJx6dYjMhYskvxT1++Oc XffA== X-Gm-Message-State: AOAM532hx1P59FvejE245VhkHLPg1jJTXEJkb8TTncO6fGlzJ5RC2W7A O+pTvZpUtMKoKV81ahfkQQh61dLWqE64NmEXREN1zAVQAOU= X-Google-Smtp-Source: ABdhPJxp18gSFmQzfvRsDIGorcRLjFGGn/u3aowlKT77T1+ApI+O0k1yHjsVPR/sr/idgkR8Kcj3nDiMdlUgsjgCbUc= X-Received: by 2002:a05:6102:cd2:: with SMTP id g18mr25325555vst.25.1634544486330; Mon, 18 Oct 2021 01:08:06 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: =?UTF-8?B?w5Z6a2FuIEtJUklL?= Date: Mon, 18 Oct 2021 11:07:55 +0300 Message-ID: Subject: Re: Iterating all VNETs from userspace application To: "Bjoern A. Zeeb" Cc: FreeBSD Net , freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4HXqHp5pblz3kRT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N I'll have a look On Mon, Oct 18, 2021 at 11:07 AM =C3=96zkan KIRIK w= rote: > > Thank you Bjoern, I'll have al > > On Mon, Oct 18, 2021 at 10:49 AM Bjoern A. Zeeb > 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 > >