[Olsr-dev] a question about the 2 ways to get system interface information in the subsystems

Henning Rogge (spam-protected)
Sun Sep 13 12:43:19 CEST 2015


On Sun, Sep 13, 2015 at 9:29 AM, work_xl <(spam-protected)> wrote:
> when I read about the introduces to oonf_interface and os_interface
> subsystems,I thought that the os_intf would connect to the os,and the
> oonf_intf would get information about interface  only though os_intf.Then I
> read the code and find sth puzzled.
> The os_interface_linux.c ,that is the code file of os_interface,has two
> os_interface_listener_add() and os_interface_listener_remove() functions
> which use the rtnetlink way to subscribe the interface-change event.But no
> plugins or subsystems use these two api.

oonf_interface.c line 145 registers a listener to os_interface.h.
line 160 in the same file removes the listener again.

> On the other hand,the
> oonf_interface.c uses its own way ,the oonf_interface_add_listener() and
> oonf_interface_remove_listener() functions which check the interface
> information periodicly with os_interface_update().Many upper-layer plugins
> use oonf 's api.

No, oonf_interface does not check in regular intervals... what can
happen is that one interface listener says "wait, something is still
in progress with the interface change, can you please trigger again in
a few hundred milliseconds".

The timer is also used for delaying the trigger of the interface
change by a few hundered milliseconds. The idea is that often an
interface is reconfigured which means it looses an IP and after that
it gets a new one... you don't want to count this as TWO changes, so I
delay the trigger.

> This make me puzzled.I thought one api for one function would be more
> graceful. Is anyone kind enough to explain this for me plz? Thanks very
> much.^^

Henning




More information about the Olsr-dev mailing list