[Openswan dev] Small optimisation for lots of interfaces

David McCullough davidm at snapgear.com
Thu Nov 24 13:57:11 CET 2005


Jivin Herbert Xu lays it down ...
> Paul Wouters <paul at xelerance.com> wrote:
> > 
> > What is the speed of 'ip addr' on that same machine? I wonder if this
> > is due to 'ifconfig' being a legacy command on Linux. It might get
> > translated internally into the appropriate 'ip' command.
> 
> It most likely is due to ifconfig's use of BSD ioctl's.  ifconfig has
> to issue multiple ioctl's for each interface while 'ip addr' can read
> a PAGE_SIZE of info on each syscall using netlink.

Actually,  I think that it is more likely to be the fact that it opens
/proc/net/dev and parses it for every interface,  just so it can show
the "stats" for the interfaces.  At least my quick look at the ifconfig code
suggests this is the case.

We have code that does the ioctls for other purposes and it isn't that
slow.

For the record,  "ip -s link" takes 2 seconds (down from 38) on the same
system :-)

Cheers,
Davidm

-- 
David McCullough, davidm at cyberguard.com.au, Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com


More information about the Dev mailing list