ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
there are two counts associated with any route, reference count and usage count,
everytime the packet uses a route, the usage count is incremented.
reference count is just to see how many connections (or transactions) are using that route. Usage count can be seen using the route -nC command, this is to see the route cache...
--iptraf is a utility that shows how many packets and bytes have left that interface,
i am not sure if there is any direct api that can give you this statistic...because netstat causes a read on the proc filesystem that contains these statistics...
you can write your own system call that can parse the whole of route cache and print the counts (these are in a structure called rtable, defined in net/route.h)..
it is not very difficult, infact, you can use a lot of kernel code to see how to write a call that can take the src and destination ips and give their statistics , by looking in the hash table (route cache)..
CORRECTION : the structure is that contains refcnt and use is not rtable but one it usesdst_entry (in net/dst.h). I apologise for the error.
yeah, you can use the routing sockets for this purposes...damn, how could i forget that...., this function uses a structure rta_cacheinfo, that is filled in by the kernel using a function called inet_rtm_getroute(), which in turn uses the function rt_fill_info() to get the job done, the fields in the
would be the ones you are interested in...