Subject: Re: Multipath
To: None <tech-net@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 09/08/2007 20:40:47
On Thu, Aug 23, 2007 at 01:29:05PM +0300, Mihai Chelaru wrote:
> David Young wrote:
> > I see a couple of places where you clear the RNF_ACTIVE bit in
> > rtrequest1(); resist the temptation.
>
> I avoid there a call to rn_delete1 in order to keep radix node alive and
> RNF_ACTIVE must be cleared for rtfree() afterwards. Isn't it OK ?
>
> > You also memcpy the radix_nodes.
>
> This is a must in order to avoid double allocation of netmask. Or isn't it ?
You need to take care to fix up embedded pointers, and pointers to the
radix_nodes, but you have not.
>
> > Do not touch the radix trie data structures directly, but use the
> > radix_node_head methods, instead. I suggest doing a delete+add with
> > the old and new "head" rtentry.
>
> Are you talking about rtentry memcpy in rtfree() ? I was thinking that it's
> faster and harmless.
I urge you to wait to optimize for speed and space until after your code
works. :-)
Do not rely on implementation details of the route table, because they
will change. Instead, use the accessor functions the table provides:
rn_delete, rn_addroute, et cetera. (I know that the existing code is not
perfectly consistent about this, but gradually I have been making it so.)
Dave
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933 ext 24