[Olsr-users] PATCH: 0.5.6 (and probably others) make dyn gw "interval" plugin parameter work

Eric Malkowski (spam-protected)
Thu Sep 4 02:52:36 CEST 2008


Hi Hannes-

Sorry about that -- I'm attaching it now.
It's very simple and I expect it should patch clean no problem.

If it's botched by e-mail -- let me know and I'll gzip it before I 
attach it.

Thanks,

-Eric

Hannes Gredler wrote:
> eric,
>
> your patch did not apply - 
>
> (spam-protected) ~/dev/olsrd $ hg import ~/patch.diff 
> applying /home/hannes/patch.diff
> /usr/bin/patch: **** malformed patch at line 12: .data = &check_interval },
>
> pls send it as email attachment (rather than c&p body text)
> or check your fix in using mercurial (we have open access).
>
> http://www.olsr.org/?q=mercurial
>
> BTW - we are not using the sf.net repo any longer (since its way to slow).
>
> clone your tree
>
> http://gredler.at/hg/olsrd (development tree)
> http://gredler.at/hg/olsrd-0.5.6 (stable branch tree).
>
> /hannes
>
> On Mon, Sep 01, 2008 at 08:37:12PM -0400, Eric Malkowski wrote:
> | The default interval for pings for the dyn_gw plugin is 5 seconds set by 
> | static variable.
> | My first try to use this (and my first try w/ OLSR in fact!) setting 
> | interval to 30 seconds yielded continuous pings.
> | 
> | I tracked it down to the fact that the plugin_parameter array in 
> | olsrd_dyn_gw.c was using it's own set_plugin_double handler when the 
> | check_interval parameter is actually an int.  When the int passed in is 
> | converted w/ set_plugin_double (at least on my setup that is compiled 
> | against uclibc 0.9.29) to set the check_interval integer parameter, the 
> | conversion must be coming out as 0 or negative. 
> | 
> | The following patch fixes this.  Even if this isn't a problem on a glibc 
> | setup, the integer plugin parameter handler should be used for dyn gw's 
> | "interval" as it's more correct since it's the number of whole seconds 
> | between pings, not a floating point number (the nanosleep used to 
> | implement it wants a struct timespec and the number of seconds is 
> | integer and nanoseconds is set to 0L in the code).
> | 
> | Also -- if the set_plugin_double helper function which I believe is code 
> | that is local to the dyn gw plugin becomes dead code w/ the patch below, 
> | it can be removed.
> | 
> | With the patch applied I can leave the default and get 5 seconds ping 
> | interval or set it to 10 seconds and see a 10 second interval instead of 
> | continuous pings.
> | 
> | The ping approach is a technique I've implemented with scripts in the 
> | past for injecting or removing default routes from OSPF setups using 
> | zebra/quagga.  The only thing I did different that might by nice in the 
> | dyn gw plugin would be to round-robin through the list of "peers" that 
> | get pinged so the first guy on the list doesn't take all the ICMP 
> | traffic most of the time -- round robin for both cases of internet link 
> | considered down and internet link considered up.
> | 
> | diff -urNp olsrd-0.5.6-orig/lib/dyn_gw/src/olsrd_dyn_gw.c 
> | olsrd-0.5.6-dyn-gw-patch/lib/dyn_gw/src/olsrd_dyn_gw.c
> | --- olsrd-0.5.6-orig/lib/dyn_gw/src/olsrd_dyn_gw.c    2008-09-01 
> | 20:11:10.000000000 -0400
> | +++ olsrd-0.5.6-dyn-gw-patch/lib/dyn_gw/src/olsrd_dyn_gw.c    2008-09-01 
> | 20:11:55.000000000 -0400
> | @@ -206,7 +206,7 @@ static int set_plugin_hna(const char *va
> |  }
> |  
> |  static const struct olsrd_plugin_parameters plugin_parameters[] = {
> | -    { .name = "interval", .set_plugin_parameter = &set_plugin_double, 
> | .data = &check_interval },
> | +    { .name = "interval", .set_plugin_parameter = &set_plugin_int, 
> | .data = &check_interval },
> |      { .name = "ping",     .set_plugin_parameter = &set_plugin_ping,   
> | .data = NULL },
> |      { .name = "hna",      .set_plugin_parameter = &set_plugin_hna,    
> | .data = NULL },
> |  };
> | diff -urNp olsrd-0.5.6-orig/lib/dyn_gw/src/olsrd_dyn_gw.h 
> | olsrd-0.5.6-dyn-gw-patch/lib/dyn_gw/src/olsrd_dyn_gw.h
> | --- olsrd-0.5.6-orig/lib/dyn_gw/src/olsrd_dyn_gw.h    2008-09-01 
> | 20:11:16.000000000 -0400
> | +++ olsrd-0.5.6-dyn-gw-patch/lib/dyn_gw/src/olsrd_dyn_gw.h    2008-09-01 
> | 20:12:07.000000000 -0400
> | @@ -43,6 +43,7 @@
> |  #define _OLSRD_PLUGIN_TEST
> |  
> |  #include "olsrd_plugin.h"
> | +#include "plugin_util.h"
> |  
> |  #define INET_NET       0
> |  #define INET_PREFIX    0
> | 
> | 
> | -- 
> | Olsr-users mailing list
> | (spam-protected)
> | http://lists.olsr.org/mailman/listinfo/olsr-users
> | 
>   

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: olsr-0.5.6-dyn-gw-interval-fix.patch
URL: <http://lists.olsr.org/pipermail/olsr-users/attachments/20080903/2491aed5/attachment.ksh>


More information about the Olsr-users mailing list