Hi ppl,

I am working on a project which has something to do with working on the kernel routing table.
So for my part, this is what I intend to achieve through a C program:

1. Get a count of the number of entries in the linux kernel routing table.
2. Get the exact memory occupied by linux kernel routing table.
3. Get details of some statistics like how many times if is the routing table being looked up.
4. Get details of some statistics like how often is the routing table being updated.

This is what I know and am doing:

1. I believe that routing table is stored at /proc/net/route and we cannot access its size through the C programming method struct stat
2. I use popen to read the output of one of the following command to get the size of the routing table:
a) wc -c | netstat -rn
b) wc -c | ip route
3. So I am using the wc with the plugs -c and -l to do my stuff I am doing but I believe it is really inefficient if my routing table has millions of entries and if I do this wc thing very frequently

Got any bright ideas better than mine?