Parsing /proc/net/route

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux