Subject: Re: Lots of ip addr aliases, best way?
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Thor Lancelot Simon <email@example.com>
Date: 09/25/2002 15:31:33
On Wed, Sep 25, 2002 at 11:46:52AM -0400, Greg A. Woods wrote:
> [ On Wednesday, September 25, 2002 at 08:54:11 (-0500), Peter Eisch wrote: ]
> > Subject: Lots of ip addr aliases, best way?
> > I'm good on all the other details but I'd like to avoid 128k aliases on an
> > interface if there's a better way to do it.
> I'm interested in knowing whether or not you did try instantiating the
> aliases, and if so whether there were any actual problems in handling
> them (I understand that doing the instantiation with 'ifconfig'
There should be no problem; when we initially wrote the interface-address
hashing code, we tested with 64K aliases and it worked fine. You'll want
to increase the number of buckets int he ifaddr hash in your kernel config
for good performance.
However, when we wrote that code someone (Bill Studenmund?) proposed an
alternate path that we didn't take -- and perhaps should have. It would
not be very invasive and would be ideally suited to problems like yours.
Instead of storing just an address and netmask for each interface address,
perhaps we should store an "address mask", which would be defined so that
any address falling within the "address mask" when applied to the address
would be accepted as local. That way you could have an interface with
address 10.0.0.9/16 (let's say) which would accept packets for any address
that fell within the 10.0.0.0/16 network. Obviously, you would have to
watch our for dependencies on "interface address" in the transmit path
and be sure to use the address to which a given socket was bound (which
could be anything within the "address mask").
This could probably be whacked together in an afternoon. _This_ afternoon,
however, I intend to climb some nice warm Sierra granite, which is how I
intend to spend most of my afternoons for at least the rest of the week.
But don't let that stop you from writing the code. ;-)
Thor Lancelot Simon firstname.lastname@example.org
But as he knew no bad language, he had called him all the names of common
objects that he could think of, and had screamed: "You lamp! You towel! You
plate!" and so on. --Sigmund Freud