Subject: Linux "/proc/net/*" support in NetBSD?
To: None <port-i386@netbsd.org>
From: Alicia da Conceicao <alicia@engine.ca>
List: port-i386
Date: 12/09/2001 08:20:39
Greetings:

I am having difficulties porting SNMP software from Linux to NetBSD
that is dependent on the very useful and handy information and
statistics that Linux provides in its "/proc/net/" directory:

arp        igmp6          ip_mr_vif   raw6       snmp          tcp6
atm/       ip6_flowlabel  ipv6_route  route      snmp6         tr_rif
dev        ip_fwchains    netlink     rpc/       sockstat      udp
dev_mcast  ip_fwnames     netstat     rt6_stats  sockstat6     udp6
if_inet6   ip_masquerade  psched      rt_acct    softnet_stat  unix
igmp       ip_mr_cache    raw         rt_cache   tcp           wireless

Of course "snmp", "dev", "tcp", "udp", and "route" are most needed.

For example, in Linux, a simple "cat /proc/net/snmp" command gives:
=======================================================================
Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
Ip: 2 64 1043996 0 0 0 0 0 964872 521563 0 0 0 95627 19081 0 0 0 1366
Icmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
Icmp: 230 54 46 54 0 0 0 6 124 0 0 0 0 19 0 13 0 0 0 0 0 6 0 0 0 0
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts
Tcp: 0 0 0 0 499 0 0 0 3 876805 445722 48 0 59
Udp: InDatagrams NoPorts InErrors OutDatagrams
Udp: 74542 4 0 74555
=======================================================================
And a "cat /proc/net/dev" command gives:
=======================================================================
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:  846040    5630    0    0    0     0          0         0   846040    5630    0    0    0     0       0          0
  eth0:441092832 1047163    0    0    0     0          0         0 165676839  518417    0    0    0  2772       0          0
=======================================================================

It is easy to see how beneficial this info can be.  Any chance that
something like this will be soon added to NetBSD-current, into either
the procfs or kernfs filesystems?  Thanks in advance.

Alicia.