extending ifmib(4) and de-mem(4)izing netstat
From: Michal Mertl (mime_at_traveller.cz)
Date: 12/13/04
- Previous message: Andre Oppermann: "Re: per-interface packet filters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Dec 2004 23:26:57 +0100 To: freebsd-net@freebsd.org
Hello all,
I like the idea of a system without mem(4) but some system utilities depend
on it. I thought I would go and change them to use other ways to get the
information. I started with 'netstat -r' and almost completely (refcnt field
is missing) removed the need for /dev/mem (in fact there already was
incomplete support for it in the sources). I then went to reimplement
'netstat -i' and found out I can't get all the information from sysctls. The
stats which I can't find are the counters for addresses configured on the
interfaces (in kernel stored in struct in_ifaddr). Am I missing something or
would I have to export the data from the kernel? What is the best way to
export them? I can see two ways: make it accessible like if_data is exported
for physical interfaces in getifaddrs(3) or export the data into some other
place like ifmib(4) - e.g. net.inet.generic and net.inet6.generic.
From getifaddrs.c I can see that one way to add the information would be to
implement something called ifam_data (probably in fact struct ifam_msghdr)
which is present on BSDI. It would probably be also possible to hack it
rather easily into sysctl_iflist (src/sys/net/rtsock.c) a-la ifm_data member
of struct if_msghdr.
P.S.: It was a great adventure to browse through the code trying to
understand what it does. Did humans write it? :-) I'm talking about the data
structures in the kernel, netstat sources are on the other hand a mess.
-- Michal Mertl _______________________________________________ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
- Previous message: Andre Oppermann: "Re: per-interface packet filters"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|