From owner-svn-src-stable@FreeBSD.ORG Thu Jun 17 21:36:01 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23961106564A for ; Thu, 17 Jun 2010 21:36:01 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id BF4C28FC23 for ; Thu, 17 Jun 2010 21:35:59 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-066-042-132.pools.arcor-ip.net [88.66.42.132]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0LrIS4-1PNpgY2hUC-013CdV; Thu, 17 Jun 2010 23:35:58 +0200 Received: (qmail 43113 invoked from network); 17 Jun 2010 21:35:58 -0000 Received: from f8x64.laiers.local (192.168.4.188) by mx.laiers.local with SMTP; 17 Jun 2010 21:35:58 -0000 From: Max Laier Organization: FreeBSD To: Max Laier Date: Thu, 17 Jun 2010 23:35:58 +0200 User-Agent: KMail/1.13.3 (FreeBSD/8.0-RELEASE-p2; KDE/4.4.3; amd64; ; ) References: <201006172038.o5HKcI1J042794@svn.freebsd.org> In-Reply-To: <201006172038.o5HKcI1J042794@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201006172335.58726.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+2Dec6fFsetJAIN6Hr608/cKOj151MWIl1OVk WMZUoLRAeBUoHGdZbQS/kfeQledYcvhZVEuzJssB+cDvsGV9AB zzs0MVOaKpvZS2TRvBp6Q== Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r209271 - stable/7/usr.sbin/arp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2010 21:36:01 -0000 On Thursday 17 June 2010 22:38:18 Max Laier wrote: > Author: mlaier > Date: Thu Jun 17 20:38:18 2010 > New Revision: 209271 > URL: http://svn.freebsd.org/changeset/base/209271 > > Log: > MFC r209063: > Cache the last result from if_indextoname for printing. This speeds up > "arp -an" when using a lot of aliases (on a single interface). > > A better fix would include a better interface for if_indextoname than > getting the whole address list from the kernel just to find the one > index->name mapping. > > > Description of fields to fill in above: 76 columns > > --| PR: If a GNATS PR is affected by the change. > > Submitted by: If someone else sent in the change. > > Reviewed by: If someone else reviewed your modification. > > Approved by: If you needed approval for this commit. > > Obtained from: If the change is from a third party. > > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > > Security: Vulnerability reference (one per line) or description. > > Empty fields above will be automatically removed. Woops ... sorry 'bout that. > _M arp > M arp/arp.c > > Modified: > stable/7/usr.sbin/arp/arp.c > Directory Properties: > stable/7/usr.sbin/arp/ (props changed) > > Modified: stable/7/usr.sbin/arp/arp.c > =========================================================================== > === --- stable/7/usr.sbin/arp/arp.c Thu Jun 17 20:10:41 2010 (r209270) +++ > stable/7/usr.sbin/arp/arp.c Thu Jun 17 20:38:18 2010 (r209271) @@ -523,6 > +523,9 @@ search(u_long addr, action_fn *action) > /* > * Display an arp entry > */ > +static char lifname[IF_NAMESIZE]; > +static int64_t lifindex = -1; > + > static void > print_entry(struct sockaddr_dl *sdl, > struct sockaddr_inarp *addr, struct rt_msghdr *rtm) > @@ -530,7 +533,6 @@ print_entry(struct sockaddr_dl *sdl, > const char *host; > struct hostent *hp; > struct iso88025_sockaddr_dl_data *trld; > - char ifname[IF_NAMESIZE]; > int seg; > > if (nflag == 0) > @@ -559,8 +561,12 @@ print_entry(struct sockaddr_dl *sdl, > } > } else > printf("(incomplete)"); > - if (if_indextoname(sdl->sdl_index, ifname) != NULL) > - printf(" on %s", ifname); > + if (sdl->sdl_index != lifindex && > + if_indextoname(sdl->sdl_index, lifname) != NULL) { > + lifindex = sdl->sdl_index; > + printf(" on %s", lifname); > + } else if (sdl->sdl_index == lifindex) > + printf(" on %s", lifname); > if (rtm->rtm_rmx.rmx_expire == 0) > printf(" permanent"); > if (addr->sin_other & SIN_PROXY) > > > !DSPAM:4c1a87f6420841209311444!