Message-ID: Date: Mon, 12 Dec 2022 13:50:51 +0100 MIME-Version: 1.0 Content-Language: en-GB References: <20221205164103.9190-1-kprovost@...2661...> <20221205164103.9190-2-kprovost@...2661...> From: Arne Schwabe In-Reply-To: Subject: Re: [Openvpn-devel] [PATCH 1/4] Read DCO traffic stats from the kernel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: Lev Stipakov , Kristof Provost Cc: openvpn-devel 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, &hi); >> + >> + while ((he = hash_iterator_next(&hi))) >> + { >> + struct multi_instance *mi = (struct multi_instance *) he->value; >> + >> + if (mi->context.c2.tls_multi->peer_id != peerid) >> + continue; > > Shouldn't we use m->instances[peerid] instead of iterating over m->hash? > Yes and a check that kernel does not give something > max_peer Arne