reading routing table

Robert Watson rwatson at FreeBSD.org
Tue Sep 2 09:19:57 UTC 2008


On Tue, 2 Sep 2008, Debarshi Ray wrote:

>> unfortunatly netstat -rn uses /dev/kmem
>
> Yes. I also found that FreeBSD's route(8) implementation does not have an 
> equivalent of 'netstat -r'. NetBSD and GNU/Linux implementations have such 
> an option. Any reason for this? Is it because you did not want to muck with 
> /dev/kmem in route(8) and wanted it to work with PF_ROUTE only? I have not 
> yet gone through NetBSD's route(8) code though.

Usually the "reason" for things like this is that no one has written the code 
to do otherwise :-).  PF_ROUTE is probably not a good mechanism for any bulk 
data transfer due to the constraints of being a datagram socket, although 
doing it via an interated dump rather than a simple dump operation would 
probably work.  Sysctl is generally a better interface for monitoring for 
various reasona, although it also has limitations.  Maintaining historic kmem 
support is important, since it is also the code used for interpreting core 
dumps, and we don't want to lose support for that.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the freebsd-net mailing list