From owner-freebsd-current@FreeBSD.ORG Sat Sep 18 17:43:01 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B89F116A4CE; Sat, 18 Sep 2004 17:43:01 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6850F43D48; Sat, 18 Sep 2004 17:43:01 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.13.1/8.13.1) with ESMTP id i8IHgTfc094361; Sat, 18 Sep 2004 13:42:29 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i8IHgOug094355; Sat, 18 Sep 2004 13:42:29 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Sat, 18 Sep 2004 13:42:24 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Brooks Davis In-Reply-To: <20040918171216.GA27533@odin.ac.hmc.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= cc: re@FreeBSD.org cc: current@FreeBSD.org Subject: Re: 5.3-RELEASE TODO X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Sep 2004 17:43:01 -0000 On Sat, 18 Sep 2004, Brooks Davis wrote: > > Have you tried seeing just how many addresses you can add before > > getifaddrs() fails to return the complete list? 128k seems like a lot, > > but I instrumente ifconf() locally a couple of weeks ago when I first > > became aware of this problem, and discovered that even on my notebook > > (which has a wireless card with one IP, and an unused ethernet card) that > > I see moderately large buffers being read from user space: > > > > ifconf: 16384 space > > Those allocations don't seem to make any sense. The actual space > required is quite small. All you do is copy one struct ifreq out for > each address, plus one for each interface with no addresses. The base > size of a struct ifreq is 32 bytes and it extends to 34 for IPv6 > addresses. The maximum size allowed by the data types is 273 (for a 255 > byte address). Since I think IPv6 are the largest addresses used in > practice, MAXPHYS is probably not too bad, though it does put a new cap > on the number of interfaces at ~4k. > > If we want to keep kernel allocations small and allow all the itnerfaces > to be reliably reported, we probably need to go back to my origional > plan where we loop repeatidly. I might do it differently by allocating > up to MAXPHYS and only reallocating if we overflow. That would avoid > doing it twice (or more) on normal machines while still being correct. I'm not too worried about theory, mostly about practice. I.e., if you add a few thousand IP addresses to a tap device, does all go happily? Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Principal Research Scientist, McAfee Research