1 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/Makefile olsrd-0-5-6-fc691af9a18d/Makefile
2 --- olsrd-0-5-6-fc691af9a18d.orig/Makefile 2009-03-14 22:39:09.000000000 +0000
3 +++ olsrd-0-5-6-fc691af9a18d/Makefile 2009-03-16 16:44:28.000000000 +0000
6 SUBDIRS := dot_draw httpinfo mini pgraph secure txtinfo
8 -SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo
9 +SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo watchdog
14 $(MAKECMD) -C lib/arprefresh
15 $(MAKECMD) -C lib/arprefresh DESTDIR=$(DESTDIR) install
18 + $(MAKECMD) -C lib/watchdog clean
19 + $(MAKECMD) -C lib/watchdog
20 + $(MAKECMD) -C lib/watchdog DESTDIR=$(DESTDIR) install
22 build_all: all switch libs
23 install_all: install install_libs
24 clean_all: uberclean clean_libs
25 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/Makefile olsrd-0-5-6-fc691af9a18d/lib/watchdog/Makefile
26 --- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/Makefile 1970-01-01 00:00:00.000000000 +0000
27 +++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/Makefile 2009-03-13 17:13:45.000000000 +0000
29 +# The olsr.org Optimized Link-State Routing daemon(olsrd)
30 +# Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
31 +# All rights reserved.
33 +# Redistribution and use in source and binary forms, with or without
34 +# modification, are permitted provided that the following conditions
37 +# * Redistributions of source code must retain the above copyright
38 +# notice, this list of conditions and the following disclaimer.
39 +# * Redistributions in binary form must reproduce the above copyright
40 +# notice, this list of conditions and the following disclaimer in
41 +# the documentation and/or other materials provided with the
43 +# * Neither the name of olsr.org, olsrd nor the names of its
44 +# contributors may be used to endorse or promote products derived
45 +# from this software without specific prior written permission.
47 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
48 +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
49 +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
50 +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
51 +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
52 +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
53 +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54 +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
55 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
57 +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
58 +# POSSIBILITY OF SUCH DAMAGE.
60 +# Visit http://www.olsr.org for more information.
62 +# If you find this software useful feel free to make a donation
63 +# to the project. For more information see the website or contact
64 +# the copyright holders.
68 +PLUGIN_NAME = olsrd_watchdog
72 +include $(TOPDIR)/Makefile.inc
74 +default_target: $(PLUGIN_FULLNAME)
76 +$(PLUGIN_FULLNAME): $(OBJS) version-script.txt
77 + $(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS)
79 +install: $(PLUGIN_FULLNAME)
80 + $(STRIP) $(PLUGIN_FULLNAME)
84 + rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME)
85 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/README_WATCHDOG olsrd-0-5-6-fc691af9a18d/lib/watchdog/README_WATCHDOG
86 --- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/README_WATCHDOG 1970-01-01 00:00:00.000000000 +0000
87 +++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/README_WATCHDOG 2009-03-13 17:13:45.000000000 +0000
89 +---------------------------------------------------------------------
90 +Watchdog PLUGIN FOR OLSRD
91 +by Henning Rogge <hrogge@googlemail.com>
92 +---------------------------------------------------------------------
94 +This plugin is used for detecting a total freeze of the olsrd by an external script.
95 +Once per timeinterval (configurable) it writes the current time into
98 +---------------------------------------------------------------------
99 +PLUGIN PARAMETERS (PlParam)
100 +---------------------------------------------------------------------
102 +PlParam "file" "/tmp/olsrd.watchdog"
103 + Name of the "still alive" file written by the watchdog
104 +PlParam "interval" "5"
105 + Overwrite the file every X seconds
108 +---------------------------------------------------------------------
110 +---------------------------------------------------------------------
112 +add in /etc/olsrd.conf:
114 +LoadPlugin "olsrd_watchdog.so.0.1"
116 + PlParam "file" "/tmp/olsrd.watchdog"
117 + PlParam "interval" "5"
121 +---------------------------------------------------------------------
123 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.c olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.c
124 --- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.c 1970-01-01 00:00:00.000000000 +0000
125 +++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.c 2009-03-16 16:51:34.000000000 +0000
129 + * The olsr.org Optimized Link-State Routing daemon(olsrd)
130 + * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
131 + * All rights reserved.
133 + * Redistribution and use in source and binary forms, with or without
134 + * modification, are permitted provided that the following conditions
137 + * * Redistributions of source code must retain the above copyright
138 + * notice, this list of conditions and the following disclaimer.
139 + * * Redistributions in binary form must reproduce the above copyright
140 + * notice, this list of conditions and the following disclaimer in
141 + * the documentation and/or other materials provided with the
143 + * * Neither the name of olsr.org, olsrd nor the names of its
144 + * contributors may be used to endorse or promote products derived
145 + * from this software without specific prior written permission.
147 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
148 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
149 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
150 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
151 + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
152 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
153 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
154 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
155 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
156 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
157 + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
158 + * POSSIBILITY OF SUCH DAMAGE.
160 + * Visit http://www.olsr.org for more information.
162 + * If you find this software useful feel free to make a donation
163 + * to the project. For more information see the website or contact
164 + * the copyright holders.
170 + * Example plugin for olsrd.org OLSR daemon
171 + * Only the bare minimum
175 +#include "olsrd_plugin.h"
176 +#include "plugin_util.h"
179 +#include "scheduler.h"
180 +#include "olsr_cookie.h"
187 +#define PLUGIN_INTERFACE_VERSION 5
189 +static struct olsr_cookie_info *watchdog_timer_cookie;
191 +static char watchdog_filename[FILENAME_MAX + 1] = "/tmp/olsr.watchdog";
192 +static int watchdog_interval = 5;
195 + * Plugin interface version
196 + * Used by main olsrd to check plugin interface version
199 +olsrd_plugin_interface_version(void)
201 + return PLUGIN_INTERFACE_VERSION;
206 +set_watchdog_file(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused)))
208 + strncpy(watchdog_filename, value, FILENAME_MAX);
213 +set_watchdog_interval(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon
214 + __attribute__ ((unused)))
216 + watchdog_interval = atoi(value);
221 + * Register parameters from config file
222 + * Called for all plugin parameters
224 +static const struct olsrd_plugin_parameters plugin_parameters[] = {
225 + {.name = "file",.set_plugin_parameter = &set_watchdog_file,.data = NULL},
226 + {.name = "interval",.set_plugin_parameter = &set_watchdog_interval,.data = NULL},
230 +olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
232 + *params = plugin_parameters;
233 + *size = ARRAYSIZE(plugin_parameters);
237 +olsr_watchdog_write_alivefile(void *foo __attribute__ ((unused)))
239 + FILE *file = fopen(watchdog_filename, "w");
240 + if (file == NULL) {
241 + OLSR_PRINTF(3, "Error, cannot write watchdog alivefile");
243 + fprintf(file, "%ld\n", (long)time(NULL));
250 + * Initialize plugin
251 + * Called after all parameters are passed
254 +olsrd_plugin_init(void)
256 + /* create the cookie */
257 + watchdog_timer_cookie = olsr_alloc_cookie("Watchdog: write alive-file", OLSR_COOKIE_TYPE_TIMER);
259 + /* Register the GW check */
260 + olsr_start_timer(watchdog_interval * MSEC_PER_SEC, 0, OLSR_TIMER_PERIODIC,
261 + &olsr_watchdog_write_alivefile, NULL, watchdog_timer_cookie->ci_id);
268 + * c-basic-offset: 2
269 + * indent-tabs-mode: nil
272 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.h olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.h
273 --- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.h 1970-01-01 00:00:00.000000000 +0000
274 +++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.h 2009-03-13 17:13:45.000000000 +0000
278 + * The olsr.org Optimized Link-State Routing daemon(olsrd)
279 + * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
280 + * All rights reserved.
282 + * Redistribution and use in source and binary forms, with or without
283 + * modification, are permitted provided that the following conditions
286 + * * Redistributions of source code must retain the above copyright
287 + * notice, this list of conditions and the following disclaimer.
288 + * * Redistributions in binary form must reproduce the above copyright
289 + * notice, this list of conditions and the following disclaimer in
290 + * the documentation and/or other materials provided with the
292 + * * Neither the name of olsr.org, olsrd nor the names of its
293 + * contributors may be used to endorse or promote products derived
294 + * from this software without specific prior written permission.
296 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
297 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
298 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
299 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
300 + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
301 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
302 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
303 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
304 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
305 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
306 + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
307 + * POSSIBILITY OF SUCH DAMAGE.
309 + * Visit http://www.olsr.org for more information.
311 + * If you find this software useful feel free to make a donation
312 + * to the project. For more information see the website or contact
313 + * the copyright holders.
318 + * Dynamic linked library for the olsr.org olsr daemon
321 +#ifndef _OLSRD_PLUGIN_MINI
322 +#define _OLSRD_PLUGIN_MINI
325 +/****************************************************************************
326 + * Functions that the plugin MUST provide *
327 + ****************************************************************************/
330 +/* Initialization function */
332 + olsrd_plugin_init(void);
335 + olsrd_plugin_interface_version(void);
341 + * c-basic-offset: 2
342 + * indent-tabs-mode: nil
345 diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/version-script.txt olsrd-0-5-6-fc691af9a18d/lib/watchdog/version-script.txt
346 --- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/version-script.txt 1970-01-01 00:00:00.000000000 +0000
347 +++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/version-script.txt 2009-03-13 17:13:45.000000000 +0000
352 + olsrd_plugin_interface_version;
354 + olsrd_get_plugin_parameters;