Parsing /proc/net/route

From: Tony Willoughby (tonyw@ma.ultranet.com)
Date: Thu Sep 14 2000 - 10:06:33 EST


Are there any known issues with /proc/net/route? It seems that
reading /proc/net/route doesn't always return all of the routes in the
routing table.

I'm writing a user-space program (that runs as root) that will go
through the routing table and delete routes with a specific gateway.
It opens /proc/net/route and reads each line by calling fgets() in a
loop until fgets() returns NULL.

Almost always, when there are several (more than 30 or so), routes in
the table fgets() returns NULL before all of the routes have been
read. Subsequent executions of this program will delete some (or all)
of the remaining routes. If the program is run enough times all of
the desired routes will be deleted.

The algorithm for reading/parsing the contents of /proc/net/route is
loosely based on netstat.c from net-tools-1.53.

I'm running 2.2.14-12. A Red Hat distribution.

Is anyone aware of any problems with /proc/net/route?

Thanks.

-- 
                      | 
Tony Willoughby       | Some nights I can't tell which finger the 
tonyw@ma.ultranet.com | thumb pick goes on.
                      |                            -Warren Zevon
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:29 EST