Subject: Re: ifaliases
To: Andrew S. Clapp <>
From: Jason Thorpe <>
List: tech-net
Date: 06/20/1996 11:02:52
On Thu, 20 Jun 1996 09:12:47 -0700 
 "Andrew S. Clapp" <> wrote:

 > Thankyou Perry for the response. 
 > Does anyone on tech-net know the answer to the above?

As Perry mentioned, the traversal of that address list can be expensive
for a large number of addresses.

However, the storage for the aliases is dynamically allocated.  Take
a look at in_control() in sys/netinet/in.c for where this actually

So, theoretically, you are only limited by the number of in_ifaddr
structures you can allocate via malloc().  You are pratically limited
by how long it takes to get to a given address.

Improving the performance of the traversal probably wouldn't be that
hard to do; the address could be hashed, or the list could be sorted
(by what, well, I haven't thought that far yet :-), when addresses are

Another way to improve the performance of the address list is to use
the notion of temporal locality to dynamically re-sort the list.  It
was observed by a co-worker here at the NAS facility (while he was
busy working on a tcp connection tracing and modeling tool) that
if you recieve a packet associated with a given connection, chances
are that you are very likely to see another packet associated with
that connection within a short period of time.

In his tool, he was able to _dramatically_ increase the performace
of tracing all connections occuring on a well-used network here simply
by placing the "packet list" at the beginning of the "all connections"
list whenever he encountered a packet for that connection.  He wrote
up a little blurb about his observation, and I'll ask him for permission
to forward it on.

Anyhow, to get on with my point, if temporal locality applies to the
demand for addresses on the address list, then it follows that a similar
increase in performance can result from dynamically rearranging that list,
given a large address list, which relatively little (almost none) expense
given a small list.

 -- save the ancient forests - -- 
Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939