From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 10 11:53:00 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A964B106567B for ; Thu, 10 Jun 2010 11:53:00 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by mx1.freebsd.org (Postfix) with ESMTP id 3AA578FC1B for ; Thu, 10 Jun 2010 11:53:00 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-064-181-139.pools.arcor-ip.net [88.64.181.139]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MQLgi-1OqMI241y0-00UdZH; Thu, 10 Jun 2010 13:52:59 +0200 Received: (qmail 12354 invoked from network); 10 Jun 2010 11:52:58 -0000 Received: from f8x64.laiers.local (192.168.4.188) by router.laiers.local with SMTP; 10 Jun 2010 11:52:58 -0000 From: Max Laier Organization: FreeBSD To: Adrian Chadd Date: Thu, 10 Jun 2010 13:52:57 +0200 User-Agent: KMail/1.13.3 (FreeBSD/8.0-RELEASE-p2; KDE/4.4.3; amd64; ; ) References: <201006092321.05453.max@love2party.net> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201006101352.57499.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+enEYcVBFB1LJRsZ+HbrIalbWhTVL+nm/IEyu hACNDO+1NqMznwPZHxvCyx921lH7Iar/SRwzOmwSDq4tiID9WF yG/Z5cb6pzJyrecbrwkWg== Cc: Nick Rogers , freebsd-hackers@freebsd.org Subject: Re: arp(8) performance w/ many aliases assigned to an interface X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2010 11:53:00 -0000 On Thursday 10 June 2010 10:05:24 Adrian Chadd wrote: > On 10 June 2010 05:21, Max Laier 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