[Olsr-dev] OLSRD RT refactoring

Hannes Gredler (spam-protected)
Sat Aug 25 02:53:45 CEST 2007


On Fri, Aug 24, 2007 at 09:48:34PM +0200, Sven-Ola Tuecke wrote:
| Hannes,
| 
| great work - thanks a lot:) I've done a little patching on top of your
| stuff - you may see them as a kind of comment from my side:

glad you like it ...

| 100-olsrd-cvs.patch
| ?? olsrd-0.5.3.tar.gz up to CVS
| 
| 101-olsrd-rt-refactoring.patch
| ?? Your patch (applyable with -p1)
| 
| 102-olsrd-rt-refactoring-fixes.patch
| ?? Because you changed a lot of basics: It's time to handle a general
| ?? flaw in the routing system. Plase take a look at chk_if_changed(). This
| ?? will free() any "struct interface" pointer without warning at any time.
| ?? This is why it's possile to SEGV olsrd with a simple "ifdown xxx". 
| ?? The patch replaces the (maybe) invalid pointer with an index reference
| ?? "iif_index". You can always ask the OS for a name. Please note, that I do
| ?? not have a working BSD toolchain, so I've placed an #error in the IPv6
| ?? BSD-part where the author/porter has started to hack something funny.

what is typically done to address 'transient' datastructure and the problem of
dead references is to refcount those datastructures.

any datastructure (mostly nexthops, neighbors) which reference the interface
should bump the refcount of the interface. same story for unreferencing.
the function that decreases the refcount from 1 to 0 frees the memory.

so if a interface goes down you just mark it as DOWN using some flag
but not free it. if you remove it from an interface tree/list
you also decrement the refcount but still not free it as long as the refcount > 0.

e.g. during SPF init we could look at those IF_DOWN bits and not
populate the neighbor in the inital neighbor set. that way all the
references to the broken interface would get decremented (post-SPF)
and once the last reference is cleared the memory is freed.

| 103-olsrd-rt-exportroute-cleanup.patch
| ?? This is the reworked hooking for quagga.

whas there something wrong for the quagga plugin ? - i have taken
care of all the plugins to work with teh new RT RIB API - including the 
quagga plugin.
 
| 104-olsrd-policy-routing.patch
| ?? This is policy routing with the changes necessary to work with
| ?? your rt-refactoring.
| 
| I have at least one soft (olsr-viz) which depends on the metric value. 

note that the SPF still calculates the correct hopcount  - any plugins
can readout that hopcount from the RT RIB API -

what the new RT implementation does is to install route entries with a
metric of 2. if olsr-vix reads back the forwarding table from the kernel,
its hopeless broken anyway ;-) what it should do is to use the RT API
to obtain the correct API.

| Mentined patches are here as ususal:
| http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/
| 
| P.S.: I'm not against vim/emacs control info in sources files. But because
| diff and patch do not handle them well, it will be more convenient if all
| source files have that comments at the end (just in case someone wants to
| apply diffs at EOF)

makes sense - shoulnd't be too difficult to mass-cat the comment
to every file in the tree.

/hannes




More information about the Olsr-dev mailing list