[Olsr-dev] [PATCH] dyn gw plugin - add PingCmd parameter

cholin (spam-protected)
Fri Oct 24 11:37:13 CEST 2014


Master only is fine. Thanks!

Regards
Nico

Am 24.10.2014 um 11:37 schrieb Ferry Huberts:
> I did see it already.
> I'll put it on master later.
> Since it's new functionality I'll not put it on the release branch
> 
> On 24/10/14 11:33, cholin wrote:
>> I merged your fixups. See [1] for the whole patch.
>>
>> Regards
>> Nico
>>
>> [1]
>> https://github.com/cholin/olsrd/commit/d0e46ec52e83ecc2811072e9bf6d553e48163704.patch
>>
>>
>> Am 07.10.2014 um 10:46 schrieb Ferry Huberts:
>>>  From d04ee8dd44b4a0c8cca80d85c3d76eccc9fba6e7 Mon Sep 17 00:00:00 2001
>>> From: Ferry Huberts <(spam-protected)>
>>> Date: Tue, 7 Oct 2014 10:40:09 +0200
>>> Subject: [PATCH] fixups
>>>
>>> ---
>>>   lib/dyn_gw/src/olsrd_dyn_gw.c | 9 +++------
>>>   lib/dyn_gw/src/olsrd_dyn_gw.h | 4 ++--
>>>   2 files changed, 5 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/lib/dyn_gw/src/olsrd_dyn_gw.c
>>> b/lib/dyn_gw/src/olsrd_dyn_gw.c
>>> index e283d71..d5883d9 100644
>>> --- a/lib/dyn_gw/src/olsrd_dyn_gw.c
>>> +++ b/lib/dyn_gw/src/olsrd_dyn_gw.c
>>> @@ -129,7 +129,7 @@ static bool check_gw(union olsr_ip_addr *,
>>> uint8_t, struct ping_list *);
>>>
>>>   static int ping_is_possible(struct ping_list *);
>>>
>>> -static char ping_cmd[PING_CMD_MAX_LEN] = {
>>> DEFAULT_PING_CHECK_INTERVAL };
>>> +static char ping_cmd[PING_CMD_MAX_LEN] = { DEFAULT_PING_CMD };
>>>
>>>   /* Event function to register with the scheduler */
>>>   static void olsr_event_doing_hna(void *);
>>> @@ -214,13 +214,10 @@ set_plugin_cmd(const char *value, void *data
>>> __attribute__ ((unused)), set_plugi
>>>     size_t len = strlen(value);
>>>
>>>     if (len < PING_CMD_MAX_LEN) {
>>> -    memcpy(ping_cmd, value, len);
>>> -    OLSR_PRINTF(2, "Set ping command to: %s\n", ping_cmd);
>>> +    strncpy(ping_cmd, value, sizeof(ping_cmd));
>>>       return 0;
>>>     }
>>>
>>> -  OLSR_PRINTF(0, "Ping command exceed max length: %d > %zu",
>>> PING_CMD_MAX_LEN, len);
>>> -
>>>     return 1;
>>>   }
>>>
>>> @@ -556,7 +553,7 @@ ping_is_possible(struct ping_list *the_ping_list)
>>>   {
>>>     struct ping_list *list;
>>>     for (list = the_ping_list; list; list = list->next) {
>>> -    char ping_command[96];
>>> +    char ping_command[sizeof(ping_cmd) + INET6_ADDRSTRLEN];
>>>       snprintf(ping_command, sizeof(ping_command), ping_cmd,
>>> list->ping_address);
>>>       olsr_printf(1, "\nDo ping on (%s) %s ...\n", ping_cmd,
>>> list->ping_address);
>>>       if (system(ping_command) == 0) {
>>> diff --git a/lib/dyn_gw/src/olsrd_dyn_gw.h
>>> b/lib/dyn_gw/src/olsrd_dyn_gw.h
>>> index bdca978..5174c63 100644
>>> --- a/lib/dyn_gw/src/olsrd_dyn_gw.h
>>> +++ b/lib/dyn_gw/src/olsrd_dyn_gw.h
>>> @@ -54,8 +54,8 @@
>>>
>>>   #define DEFAULT_HNA_CHECK_INTERVAL    1000
>>>   #define DEFAULT_PING_CHECK_INTERVAL    5
>>> -#define DEFAULT_PING_CMD                "ping -c 1 -q %s"
>>> -#define PING_CMD_MAX_LEN                64
>>> +#define DEFAULT_PING_CMD            "ping -c 1 -q %s"
>>> +#define PING_CMD_MAX_LEN            64
>>>
>>>   int olsrd_plugin_init(void);
>>>
>>>
>>
>>
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20141024/f00d87ce/attachment.sig>


More information about the Olsr-dev mailing list