[Olsr-dev] invalidate node links

Henning Rogge (spam-protected)
Wed Jan 25 17:23:16 CET 2012


On Wed, Jan 25, 2012 at 16:23, Giovanni Di Stasi <(spam-protected)> wrote:
>> We have some "quick shotdown" feature for OLSR that uses something that
>> might
>> work for you. You can invalidate a link by sending a Hello with the
>> corresponding connections marked as state "dropped".
>>
>> Look into main.c, line 725 to 735.
>>
>> olsr_reset_all_links() sets ALL links to state dropped (you need a version
>> that only does this for a single link).
>>
>> olsr_shutdown_messages() sends out a hello and TC for all links (again you
>> need a limited one).
>
> I have followed your advice and come up with this initial solution ( please
> find the patch attached). I have two functions, one that sets the links as
> LOST (invalidate_links_interface) and the other that sends the HELLO and TC
> messages and remove the kernel routes.  I have in particular the following
> concerns:
>
> 1) is the internal state of olsrd going to be consistent after I modify the
> state of the links with the function olsr_reset_all_links_interface?
I would maybe call the function with a pointer to the corresponding
"interface" struct or the interface index. Names can be problematic.
Also you don't need to worry about modifying the link_set yourself,
you can just use the function olsr_delete_link_entry() to delete each
link entry that is on the "bad" interface.

> 2) do I also need to call olsr_delete_all_kernel_routes  after the
> invalidation or olsr takes care automatically to replace the old routes with
>  it taken care automatically to replace the old kernel routes
Using olsr_delete_link_entry() should take care of cleaning up other
data structures and should trigger the route change too.

> 3) do you think the sleeping time (usleep(1000000)) if sufficient to be sure
> that the HELLO and TC messages are sent ( after the usleep I call iwconfig
> to change channels) ?
I would suggest not using any kind of sleep()... because this will
freeze OLSRd. Better use a timer that will call your external function
(or just do the job directly from OLSRd by using ioctls() ). Still,
there is no guarantee anyways that packets will "ever" go out. So the
timer doesn't help that much too.

I also am a little bit worried about incoming Hellos after you cleaned
up and before you shut down the interface. Maybe you will need some
flag in the interface struct that marks this interface as "do not
accept traffic".

Henning Rogge

-- 
"Wo kämen wir hin, wenn alle sagten, wo kämem wir hin, und niemand
ginge, um einmal zu schauen, wohin man käme, wenn man ginge." (Kurt
Marti)




More information about the Olsr-dev mailing list