[olsr-dev] some Qs about exending the dyn_gw plugin

Andreas Tønnesen (spam-protected)
Fri Nov 5 18:24:25 CET 2004


Hi Jens,

Here are som quick responses(I'm on my way out here)

> 1st 
> I've seen the new config file scheme:
> LoadPlugin "olsrd_dyn_gw.so.0.1"
> {
>     PlParam     "key4"   "value3"
>     # Might be possible to set options here in
>     # future versions
> }
> This would mean one IP per line, right? e.g.
> 
> LoadPlugin "olsrd_dyn_gw.so.0.1"
> {
>     PlParam     "IP_1"   "141.1.1.1"
>     PlParam     "IP_2"   "141.6.6.6"
>     # Might be possible to set options here in
>     # future versions
> }
> and not 
> LoadPlugin "olsrd_dyn_gw.so.0.1"
> {
>     PlParam     "IPs"   "141.1.1.1"  "141.6.6.6"
>     # Might be possible to set options here in
>     # future versions
> }
> ???

Yes - that means that you can set keys/values pairs. I would guess 
something like this would be suitable:

  LoadPlugin "olsrd_dyn_gw.so.0.1"
  {
      PlParam     "Detection" "ping" # ping or route
      PlParam     "Net"   "0.0.0.0/0"
      PlParam     "Net"   "141.1.1.1/24"
# etc.
  }


> 2nd
> How can these values in the config be accessed, without rereading the 
> config files? (I could not find an obvious enough name in 
> olsr_plugin_io.h)

There is a new interface for this in current CVS. The plugin loader will 
try to fetch a function called register_olsr_param typed to:
int (*register_param)(char *, char *);

If this function can be found, then olsrd will pass all key/value pairs 
to the plugin using this call.
This means that the plugin loader will be responsble for passing the 
parameters to the plugin. This is done _before_ olsrd calls the 
register_olsr_data function in the plugin. So one knows that when 
register_olsr_data is called - all parameters have been passed to the 
plugin.

> 3rd
> Currently I use system(2) [e.g. system("ping -c 1 -q IP")] to do the 
> ping, which is suboptimal since the ping would be done with olsrd's 
> prevelidges (i.e. root) and afaics it also blocks olsrd while the ping 
> the going on. Anybody knowing a better approach or syscall, 
> respectively?

You could spawn a thread to do this. You can also build and send the 
ICMP packet your self so you don't have to depend on external programs.

Keep us updated!

- Andreas

-- 
Andreas Tønnesen
http://www.olsr.org



More information about the Olsr-dev mailing list