arp(8) performance w/ many aliases assigned to an interface

Max Laier max at love2party.net
Thu Jun 10 11:53:00 UTC 2010


On Thursday 10 June 2010 10:05:24 Adrian Chadd wrote:
> On 10 June 2010 05:21, Max Laier <max at love2party.net> wrote:
> >> Is there something that can be done to speedup the call to
> >> if_indextoname(), or would it be worthwhile for me to submit a patch
> >> that adds the ability to skip the interface lookup as an arp(8) option?
> > 
> > how about the attached:
> This patch only short-circuits the lookup for a specific case - lots
> of entries with the same ifname. What about other situations - say,
> alternating interfaces in ARP?

Yes, it is bandaid, but I believe it covers most if not all common cases.  I 
didn't want to start with a full cache, to avoid a big memory footprint.

> I read if_indextoname(). The problem is that each call is sucking down
> the ifaddrs table and looking for the index. Is this likely to be a
> problem in other situations, rather than just /usr/sbin/arp ?

I was also thinking about building a sysctl to export index to name 
information directly, but I don't think it's worth the hassle.  Other (long 
running) programs that need index->name mapping over and over again already do 
caching that is specific to their particular usecase.  See e.g. routed's if.c

Regards,
  Max


More information about the freebsd-hackers mailing list