Re: [pfinet] no per-interface byte / packet counter RPC; please add SIOCGIFSTATS or equivalent

Borja Tarraso <[email protected]>
Newsgroups gmane.os.hurd.bugs
Message-ID <CAOykPARMztMHAFwOmscmp+7Y0t3BZAC+cH3tgWZUmC76BkU1AQ@mail.gmail.com>
Hi Samuel,

> I don't really see these macros being widely used?
> Better implement something that is a largely-known interface,
> for instance a common BSD interface.

Agreed on dropping SIOCGIFSTATS as the target shape. Two BSD
candidates fit pfinet's per-iface model and either has live
userland on the consumer side:

  (a) getifaddrs(3) growing a populated ifa_data field of type
      `struct if_data` (sys/net/if.h on the BSDs; fields
      ifi_ibytes / ifi_obytes / ifi_ipackets / ifi_opackets /
      ifi_ierrors / ifi_oerrors / ifi_iqdrops, plus a handful
      more).  This is the modern BSD path; ifconfig on the BSDs,
      `netstat -i`, and the BSD-flavoured rust / go netlink
      stand-ins all read from it.

  (b) sysctl(NET_RT_IFLIST2) populating `struct if_msghdr2` with
      the same if_data block. Older, heavier on the pfinet side
      because it adds a sysctl surface that does not exist today.

Provisionally I would go (a) since it requires the smaller new
surface (one populated field on existing API rather than a new
sysctl tree). I have some open questions before drafting:

  - Does Hurd's glibc getifaddrs currently leave ifa_data NULL
    on pfinet-backed interfaces, or is there already a partial
    surface I have not noticed?  If NULL today, the patch is
    "pfinet emits if_data via a new MIG routine + glibc-side
    getifaddrs back-end reads it".  If partially populated, the
    patch is "extend the existing emission with counter fields".
  - Either (a) or (b), do you have a preference on the MIG-side
    shape, an array-return routine vs a per-iface routine that
    callers iterate?

Happy to test once a draft lands.  I will not block on writing
the patch myself in the short term but will pivot the original
ask off SIOCGIFSTATS in the bug record either way.

Thanks,
Borja Tarraso
[email protected]

El dom, 31 may 2026 a las 12:28, Samuel Thibault
(<[email protected]>) escribió:
>
> Hello,
>
> Borja Tarraso, le sam. 30 mai 2026 22:53:54 +0300, a ecrit:
> > On Debian GNU/Hurd 0.9 (pfinet as shipped in the hurd source package,
> > hurd 1:0.9.git20230520-7), there is no RPC, no ioctl, and no procfs
> > file that returns per-interface byte / packet counters.
>
> Contribution welcome!
>
> >   1. /usr/include/x86_64-gnu/bits/ioctls.h defines SIOC* constants
> >      No SIOCGIFSTATS, no SIOCGIFMIB, no SIOCGIFDATA, no
> >      SIOCGIFCOUNTERS macro anywhere under /usr/include.
>
> I don't really see these macros being widely used?
> Better implement something that is a largely-known interface, for
> instance a common BSD interface.
>
> (the Linux way, /proc, won't be helpful to us since that only defers the
> question to the pfinet interface question anyway)
>
> Samuel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.