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];
> > +    nvlist_t *nvl;
> > +    const nvlist_t *const *nvpeers;
> > +    size_t npeers;
> > +    int ret;
> > +
> > +    if (!dco || !dco->open)
> > +    {
> > +        return 0;
> > +    }
> > +
> > +    CLEAR(drv);
> > +    snprintf(drv.ifd_name, IFNAMSIZ, "%s", dco->ifname);
> > +    drv.ifd_cmd = OVPN_GET_PEER_STATS;
> 
> What speaks against having a simple GET_PEER here which returns the full 
> peer object with all possible attributes?
> 
> This way, if we want to retrieve another attribute in the future, this 
> attribute will already be delivered by the same API, without the need to 
> implement a new command each time.

One counter-argument would be "the statistics are polled more often than
'all information about a peer object', so it should be less costly"
(also, when do we ever poll 'all attributes'?  Since OpenVPN *sets*
these, we should know, except for the counters...)

gert

-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to