Date: Thu, 21 Jul 2005 11:06:56 -0700 From: Anders Persson <anders@cs.ucla.edu> To: freebsd-net@freebsd.org Subject: interface cleanup Message-ID: <91885646-8E16-4D06-91D7-307DD5836475@cs.ucla.edu>
next in thread | raw e-mail | index | archive | help
Hi all, My name is Anders Persson and I am working on a Google SoC project in which I am trying to remove reference made from user land to kernel- only data structures. Currently I am going through netstat and rewriting some of the functions to rely on sysctl rather than kvm. The hope is to completely remove kvm from netstat, and parts that solely depend on it, like the core dump analysis would be factored out and moved to a more suitable place (kgdb?) In many cases this works quite well, and the public interfaces contain most of the information needed. In some cases certain pieces of information are not available. A specific example would be routing information, where I try to rely on routing messages to obtain the info. However, one piece of information that is missing is the ref count (rt_refcnt in rtentry). If this is one piece of information deemed necessary, what is the general opinion of including that in rt_msghdr? (Just a side note, I noticed there is both rtm_use and rtm_rmx.rmx_pksent in rt_msghdr, however when dumping an rtentry, the pksent metric of the entry is assigned to rtm_use and rmx_pksent is left unassigned, I assume this is done to avoid breaking legacy code?) The parts of netstat I am currently looking at are multicast routing info and netgraph. For both of these parts there seem to be no public interfaces to query for information. However, mrouting in IPv4 provide access to the internal structures which partially avoids using kvm (in one case you sysctl returns a list of mem locations so you have to do a sysctl/kvm combo to get the stuff you want), however, the structs that are returned contains pointers to other internal data such as ifnet's. There already exists some basic ioctl () request to obtain partial information, but I was thinking of extending the publicly available information by either adding a few more ioctl request, or extending the information available via sysctl. I guess the more complex task would be to efficiently dump the routing cache with bandwidth meters etc. Any thoughts about this? I have not had time to go through netgraph enough yet, but does anyone have some ideas how to avoid using kvm to obtain netgraph info? Thanks a lot, Anders
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?91885646-8E16-4D06-91D7-307DD5836475>