luci-0.9: merge r4896
This commit is contained in:
parent
022404df01
commit
3a06c9ee2f
3 changed files with 55 additions and 409 deletions
|
@ -11,13 +11,13 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_BASENAME:=olsrd
|
||||
PKG_NAME:=$(PKG_BASENAME)-luci
|
||||
PKG_BASEVER:=0.5.6-r4
|
||||
PKG_RELEASE:=2
|
||||
PKG_BASEVER:=0.5.6-r5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_HGREV:=edc947c1a5bc
|
||||
PKG_HGREV:=5ed3e2c2760c
|
||||
PKG_SOURCE:=$(PKG_HGREV).tar.gz
|
||||
PKG_SOURCE_URL:=http://gredler.at/hg/olsrd-0.5.6/archive
|
||||
PKG_MD5SUM:=88f6ccdfe3b75ce7b942849be2bfc8a8
|
||||
PKG_MD5SUM:=b3da5372337567a7894624afc6f0277a
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_HGREV)
|
||||
PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE)
|
||||
PKG_VERSION:=$(PKG_BASEVER)+$(PKG_HGREV)+luci1
|
||||
|
|
|
@ -303,7 +303,7 @@
|
|||
}
|
||||
return olsr_cnf;
|
||||
}
|
||||
@@ -401,7 +405,9 @@
|
||||
@@ -405,7 +409,9 @@
|
||||
|
||||
cnf->debug_level = DEF_DEBUGLVL;
|
||||
cnf->no_fork = false;
|
||||
|
@ -313,7 +313,7 @@
|
|||
cnf->ip_version = AF_INET;
|
||||
cnf->ipsize = sizeof(struct in_addr);
|
||||
cnf->maxplen = 32;
|
||||
@@ -412,7 +418,9 @@
|
||||
@@ -416,7 +422,9 @@
|
||||
cnf->rtproto = DEF_RTPROTO;
|
||||
cnf->rttable_default = 0;
|
||||
cnf->willingness_auto = DEF_WILL_AUTO;
|
||||
|
@ -323,7 +323,7 @@
|
|||
cnf->fib_metric = DEF_FIB_METRIC;
|
||||
|
||||
cnf->use_hysteresis = DEF_USE_HYST;
|
||||
@@ -491,6 +499,7 @@
|
||||
@@ -495,6 +503,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@
|
|||
void
|
||||
olsrd_print_cnf(struct olsrd_config *cnf)
|
||||
{
|
||||
@@ -634,6 +643,7 @@
|
||||
@@ -638,6 +647,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@
|
|||
%token TOK_FIBMETRIC
|
||||
%token TOK_USEHYST
|
||||
%token TOK_HYSTSCALE
|
||||
@@ -202,7 +201,6 @@
|
||||
@@ -203,7 +202,6 @@
|
||||
|
||||
%token TOK_HOSTLABEL
|
||||
%token TOK_NETLABEL
|
||||
|
@ -357,7 +357,7 @@
|
|||
|
||||
%token TOK_IP4BROADCAST
|
||||
%token TOK_IFMODE
|
||||
@@ -265,7 +263,6 @@
|
||||
@@ -267,7 +265,6 @@
|
||||
|
||||
block: TOK_HNA4 hna4body
|
||||
| TOK_HNA6 hna6body
|
||||
|
@ -365,7 +365,7 @@
|
|||
| ifblock ifbody
|
||||
| plblock plbody
|
||||
;
|
||||
@@ -290,18 +287,6 @@
|
||||
@@ -292,18 +289,6 @@
|
||||
| ihna6entry
|
||||
;
|
||||
|
||||
|
@ -384,7 +384,7 @@
|
|||
ifblock: ifstart ifnicks
|
||||
;
|
||||
|
||||
@@ -343,77 +328,6 @@
|
||||
@@ -345,77 +330,6 @@
|
||||
| vcomment
|
||||
;
|
||||
|
||||
|
@ -527,7 +527,7 @@
|
|||
* Local Variables:
|
||||
--- a/src/hna_set.c
|
||||
+++ b/src/hna_set.c
|
||||
@@ -279,6 +279,7 @@
|
||||
@@ -280,6 +280,7 @@
|
||||
*
|
||||
*@return nada
|
||||
*/
|
||||
|
@ -535,7 +535,7 @@
|
|||
void
|
||||
olsr_print_hna_set(void)
|
||||
{
|
||||
@@ -320,6 +321,7 @@
|
||||
@@ -321,6 +322,7 @@
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -710,7 +710,7 @@
|
|||
}
|
||||
+#ifndef SVEN_OLA_UNBLOAT
|
||||
//send ipc update on success
|
||||
if ( ( cmd != RTM_NEWRULE ) & ( cmd != RTM_DELRULE ) & (flag = RT_ORIG_REQUEST) & (0 <= rt_ret && olsr_cnf->ipc_connections > 0)) {
|
||||
if ( ( cmd != RTM_NEWRULE ) && ( cmd != RTM_DELRULE ) && (flag = RT_ORIG_REQUEST) && (0 <= rt_ret && olsr_cnf->ipc_connections > 0)) {
|
||||
ipc_route_send_rtentry(&rt->rt_dst.prefix, &nexthop->gateway, metric, RTM_NEWROUTE == cmd,
|
||||
if_ifwithindex_name(nexthop->iif_index));
|
||||
}
|
||||
|
@ -738,7 +738,7 @@
|
|||
|
||||
memset(&kernel_route, 0, sizeof(struct in6_rtmsg));
|
||||
|
||||
@@ -469,7 +475,9 @@
|
||||
@@ -468,7 +474,9 @@
|
||||
int rslt;
|
||||
#endif /* LINUX_POLICY_ROUTING */
|
||||
|
||||
|
@ -748,7 +748,7 @@
|
|||
|
||||
#if !LINUX_POLICY_ROUTING
|
||||
memset(&kernel_route, 0, sizeof(struct rtentry));
|
||||
@@ -536,7 +544,9 @@
|
||||
@@ -535,7 +543,9 @@
|
||||
int rslt;
|
||||
#endif /* LINUX_POLICY_ROUTING */
|
||||
|
||||
|
@ -977,7 +977,7 @@
|
|||
}
|
||||
|
||||
/*
|
||||
@@ -417,7 +423,11 @@
|
||||
@@ -399,7 +405,11 @@
|
||||
* @return pointer to hello_neighbor
|
||||
*/
|
||||
struct hello_neighbor *
|
||||
|
@ -989,7 +989,7 @@
|
|||
{
|
||||
struct hello_neighbor *h;
|
||||
|
||||
@@ -439,7 +449,11 @@
|
||||
@@ -421,7 +431,11 @@
|
||||
* @return pointer to tc_mpr_addr
|
||||
*/
|
||||
struct tc_mpr_addr *
|
||||
|
@ -1001,7 +1001,7 @@
|
|||
{
|
||||
struct tc_mpr_addr *t;
|
||||
|
||||
@@ -461,7 +475,11 @@
|
||||
@@ -443,7 +457,11 @@
|
||||
* @return pointer to lq_hello_neighbor
|
||||
*/
|
||||
struct lq_hello_neighbor *
|
||||
|
@ -1013,7 +1013,7 @@
|
|||
{
|
||||
struct lq_hello_neighbor *h;
|
||||
|
||||
@@ -483,7 +501,11 @@
|
||||
@@ -465,7 +483,11 @@
|
||||
* @return pointer to link_entry
|
||||
*/
|
||||
struct link_entry *
|
||||
|
@ -1035,7 +1035,7 @@
|
|||
#include "tc_set.h"
|
||||
#include "link_set.h"
|
||||
#include "olsr_spf.h"
|
||||
@@ -223,6 +224,7 @@
|
||||
@@ -212,6 +213,7 @@
|
||||
|
||||
return buffer->buf;
|
||||
}
|
||||
|
@ -1053,7 +1053,7 @@
|
|||
#ifndef LQ_PLUGIN_DEFAULT_H_
|
||||
#define LQ_PLUGIN_DEFAULT_H_
|
||||
|
||||
@@ -77,6 +78,7 @@
|
||||
@@ -75,6 +76,7 @@
|
||||
extern struct lq_handler lq_etx_float_handler;
|
||||
|
||||
#endif /*LQ_PLUGIN_DEFAULT_H_ */
|
||||
|
@ -1071,7 +1071,7 @@
|
|||
#include "tc_set.h"
|
||||
#include "link_set.h"
|
||||
#include "lq_plugin.h"
|
||||
@@ -235,6 +236,7 @@
|
||||
@@ -238,6 +239,7 @@
|
||||
snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", (float)(cost) / LQ_FPM_LINKCOST_MULTIPLIER);
|
||||
return buffer->buf;
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@
|
|||
#ifndef LQ_ETX_FPM_
|
||||
#define LQ_ETX_FPM_
|
||||
|
||||
@@ -83,6 +84,7 @@
|
||||
@@ -79,6 +80,7 @@
|
||||
extern struct lq_handler lq_etx_fpm_handler;
|
||||
|
||||
#endif /*LQ_ETX_FPM_ */
|
||||
|
@ -1099,7 +1099,7 @@
|
|||
* Local Variables:
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -256,13 +256,17 @@
|
||||
@@ -312,13 +312,17 @@
|
||||
/*
|
||||
* Print configuration
|
||||
*/
|
||||
|
@ -1117,7 +1117,7 @@
|
|||
|
||||
/*
|
||||
* socket for ioctl calls
|
||||
@@ -298,7 +302,9 @@
|
||||
@@ -354,7 +358,9 @@
|
||||
/*
|
||||
*enable ip forwarding on host
|
||||
*/
|
||||
|
@ -1127,7 +1127,7 @@
|
|||
|
||||
/* Initialize parser */
|
||||
olsr_init_parser();
|
||||
@@ -316,6 +322,7 @@
|
||||
@@ -372,6 +378,7 @@
|
||||
*Set up willingness/APM
|
||||
*/
|
||||
if (olsr_cnf->willingness_auto) {
|
||||
|
@ -1135,7 +1135,7 @@
|
|||
if (apm_init() < 0) {
|
||||
OLSR_PRINTF(1, "Could not read APM info - setting default willingness(%d)\n", WILL_DEFAULT);
|
||||
|
||||
@@ -324,10 +331,13 @@
|
||||
@@ -382,10 +389,13 @@
|
||||
olsr_cnf->willingness_auto = 0;
|
||||
olsr_cnf->willingness = WILL_DEFAULT;
|
||||
} else {
|
||||
|
@ -1149,7 +1149,7 @@
|
|||
}
|
||||
|
||||
/* Initialize net */
|
||||
@@ -355,9 +365,11 @@
|
||||
@@ -415,9 +425,11 @@
|
||||
|
||||
/* Initialize the IPC socket */
|
||||
|
||||
|
@ -1161,7 +1161,7 @@
|
|||
/* Initialisation of different tables to be used. */
|
||||
olsr_init_tables();
|
||||
|
||||
@@ -487,9 +499,11 @@
|
||||
@@ -549,9 +561,11 @@
|
||||
OLSR_PRINTF(1, "Closing sockets...\n");
|
||||
|
||||
/* front-end IPC socket */
|
||||
|
@ -1173,7 +1173,7 @@
|
|||
|
||||
/* OLSR sockets */
|
||||
for (ifn = ifnet; ifn; ifn = ifn->int_next)
|
||||
@@ -499,7 +513,9 @@
|
||||
@@ -561,7 +575,9 @@
|
||||
olsr_close_plugins();
|
||||
|
||||
/* Reset network settings */
|
||||
|
@ -1183,19 +1183,19 @@
|
|||
|
||||
/* ioctl socket */
|
||||
close(olsr_cnf->ioctl_s);
|
||||
@@ -540,7 +556,11 @@
|
||||
"usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n"
|
||||
" [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n"
|
||||
" [-lql <LQ level>] [-lqw <LQ winsize>] [-lqnt <nat threshold>]\n"
|
||||
@@ -601,7 +617,11 @@
|
||||
"usage: olsrd [-f <configfile>] [ -i interface1 interface2 ... ]\n"
|
||||
" [-d <debug_level>] [-ipv6] [-multi <IPv6 multicast address>]\n"
|
||||
" [-lql <LQ level>] [-lqw <LQ winsize>] [-lqnt <nat threshold>]\n"
|
||||
+#ifdef SVEN_OLA_UNBLOAT
|
||||
+ " [-bcast <broadcastaddr>] [-delgw] (Note: no -ipc,-dispin,-dispout)\n"
|
||||
+#else /* SVEN_OLA_UNBLOAT */
|
||||
" [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n"
|
||||
+ " [-bcast <broadcastaddr>] [-delgw] (Note: no -ipc,-dispin,-dispout)\n"
|
||||
+#else
|
||||
" [-bcast <broadcastaddr>] [-ipc] [-dispin] [-dispout] [-delgw]\n"
|
||||
+#endif /* SVEN_OLA_UNBLOAT */
|
||||
" [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n"
|
||||
" [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n"
|
||||
" [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>]\n" " [-lql <LQ level>] [-lqa <LQ aging factor>]\n");
|
||||
@@ -704,12 +724,20 @@
|
||||
" [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n"
|
||||
" [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n"
|
||||
" [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>]\n" " [-lql <LQ level>] [-lqa <LQ aging factor>]\n");
|
||||
@@ -765,12 +785,20 @@
|
||||
olsr_exit(__func__, EXIT_FAILURE);
|
||||
}
|
||||
printf("Queuing if %s\n", *argv);
|
||||
|
@ -1216,7 +1216,7 @@
|
|||
}
|
||||
|
||||
continue;
|
||||
@@ -771,7 +799,7 @@
|
||||
@@ -833,7 +861,7 @@
|
||||
sscanf(*argv, "%f", &cnf->pollrate);
|
||||
continue;
|
||||
}
|
||||
|
@ -1225,7 +1225,7 @@
|
|||
/*
|
||||
* Should we display the contents of packages beeing sent?
|
||||
*/
|
||||
@@ -795,6 +823,7 @@
|
||||
@@ -857,6 +885,7 @@
|
||||
cnf->ipc_connections = 1;
|
||||
continue;
|
||||
}
|
||||
|
@ -1233,7 +1233,7 @@
|
|||
|
||||
/*
|
||||
* IPv6 multicast addr
|
||||
@@ -812,7 +841,7 @@
|
||||
@@ -874,7 +903,7 @@
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@
|
|||
/*
|
||||
* Host emulation
|
||||
*/
|
||||
@@ -840,6 +869,7 @@
|
||||
@@ -902,6 +931,7 @@
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -1455,7 +1455,7 @@
|
|||
struct olsr_if *interfaces;
|
||||
float pollrate;
|
||||
float nic_chgs_pollrate;
|
||||
@@ -269,7 +277,9 @@
|
||||
@@ -271,7 +279,9 @@
|
||||
|
||||
void olsrd_free_cnf(struct olsrd_config *);
|
||||
|
||||
|
@ -1552,15 +1552,19 @@
|
|||
}
|
||||
|
||||
/**
|
||||
@@ -385,7 +401,7 @@
|
||||
@@ -385,9 +401,11 @@
|
||||
/* route additions */
|
||||
olsr_add_kernel_routes(&add_kernel_list);
|
||||
|
||||
-#if DEBUG
|
||||
+#ifndef SVEN_OLA_UNBLOAT
|
||||
+#ifdef DEBUG
|
||||
olsr_print_routing_table(&routingtree);
|
||||
#endif
|
||||
+#endif /* SVEN_OLA_UNBLOAT */
|
||||
}
|
||||
|
||||
/*
|
||||
--- a/src/rebuild_packet.c
|
||||
+++ b/src/rebuild_packet.c
|
||||
@@ -60,7 +60,11 @@
|
||||
|
@ -1671,7 +1675,7 @@
|
|||
|
||||
/**
|
||||
* Wrapper for the timer callback.
|
||||
@@ -694,6 +696,7 @@
|
||||
@@ -693,6 +695,7 @@
|
||||
/**
|
||||
* Print the topology table to stdout
|
||||
*/
|
||||
|
@ -1679,7 +1683,7 @@
|
|||
void
|
||||
olsr_print_tc_table(void)
|
||||
{
|
||||
@@ -719,6 +722,7 @@
|
||||
@@ -718,6 +721,7 @@
|
||||
} OLSR_FOR_ALL_TC_ENTRIES_END(tc);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -1,358 +0,0 @@
|
|||
diff -Nur olsrd-0-5-6-fc691af9a18d.orig/Makefile olsrd-0-5-6-fc691af9a18d/Makefile
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/Makefile 2009-03-14 22:39:09.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/Makefile 2009-03-16 16:44:28.000000000 +0000
|
||||
@@ -148,7 +148,7 @@
|
||||
ifeq ($(OS),win32)
|
||||
SUBDIRS := dot_draw httpinfo mini pgraph secure txtinfo
|
||||
else
|
||||
-SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo
|
||||
+SUBDIRS := bmf dot_draw dyn_gw dyn_gw_plain httpinfo mini nameservice pgraph secure txtinfo watchdog
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -229,6 +229,11 @@
|
||||
$(MAKECMD) -C lib/arprefresh
|
||||
$(MAKECMD) -C lib/arprefresh DESTDIR=$(DESTDIR) install
|
||||
|
||||
+watchdog:
|
||||
+ $(MAKECMD) -C lib/watchdog clean
|
||||
+ $(MAKECMD) -C lib/watchdog
|
||||
+ $(MAKECMD) -C lib/watchdog DESTDIR=$(DESTDIR) install
|
||||
+
|
||||
build_all: all switch libs
|
||||
install_all: install install_libs
|
||||
clean_all: uberclean clean_libs
|
||||
diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/Makefile olsrd-0-5-6-fc691af9a18d/lib/watchdog/Makefile
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/Makefile 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/Makefile 2009-03-13 17:13:45.000000000 +0000
|
||||
@@ -0,0 +1,56 @@
|
||||
+# The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||
+# Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
|
||||
+# All rights reserved.
|
||||
+#
|
||||
+# Redistribution and use in source and binary forms, with or without
|
||||
+# modification, are permitted provided that the following conditions
|
||||
+# are met:
|
||||
+#
|
||||
+# * Redistributions of source code must retain the above copyright
|
||||
+# notice, this list of conditions and the following disclaimer.
|
||||
+# * Redistributions in binary form must reproduce the above copyright
|
||||
+# notice, this list of conditions and the following disclaimer in
|
||||
+# the documentation and/or other materials provided with the
|
||||
+# distribution.
|
||||
+# * Neither the name of olsr.org, olsrd nor the names of its
|
||||
+# contributors may be used to endorse or promote products derived
|
||||
+# from this software without specific prior written permission.
|
||||
+#
|
||||
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
+# POSSIBILITY OF SUCH DAMAGE.
|
||||
+#
|
||||
+# Visit http://www.olsr.org for more information.
|
||||
+#
|
||||
+# If you find this software useful feel free to make a donation
|
||||
+# to the project. For more information see the website or contact
|
||||
+# the copyright holders.
|
||||
+#
|
||||
+
|
||||
+OLSRD_PLUGIN = true
|
||||
+PLUGIN_NAME = olsrd_watchdog
|
||||
+PLUGIN_VER = 0.1
|
||||
+
|
||||
+TOPDIR = ../..
|
||||
+include $(TOPDIR)/Makefile.inc
|
||||
+
|
||||
+default_target: $(PLUGIN_FULLNAME)
|
||||
+
|
||||
+$(PLUGIN_FULLNAME): $(OBJS) version-script.txt
|
||||
+ $(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS)
|
||||
+
|
||||
+install: $(PLUGIN_FULLNAME)
|
||||
+ $(STRIP) $(PLUGIN_FULLNAME)
|
||||
+ $(INSTALL_LIB)
|
||||
+
|
||||
+clean:
|
||||
+ rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME)
|
||||
diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/README_WATCHDOG olsrd-0-5-6-fc691af9a18d/lib/watchdog/README_WATCHDOG
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/README_WATCHDOG 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/README_WATCHDOG 2009-03-13 17:13:45.000000000 +0000
|
||||
@@ -0,0 +1,34 @@
|
||||
+---------------------------------------------------------------------
|
||||
+Watchdog PLUGIN FOR OLSRD
|
||||
+by Henning Rogge <hrogge@googlemail.com>
|
||||
+---------------------------------------------------------------------
|
||||
+
|
||||
+This plugin is used for detecting a total freeze of the olsrd by an external script.
|
||||
+Once per timeinterval (configurable) it writes the current time into
|
||||
+a file.
|
||||
+
|
||||
+---------------------------------------------------------------------
|
||||
+PLUGIN PARAMETERS (PlParam)
|
||||
+---------------------------------------------------------------------
|
||||
+
|
||||
+PlParam "file" "/tmp/olsrd.watchdog"
|
||||
+ Name of the "still alive" file written by the watchdog
|
||||
+PlParam "interval" "5"
|
||||
+ Overwrite the file every X seconds
|
||||
+
|
||||
+
|
||||
+---------------------------------------------------------------------
|
||||
+SAMPLE CONFIG
|
||||
+---------------------------------------------------------------------
|
||||
+
|
||||
+add in /etc/olsrd.conf:
|
||||
+
|
||||
+LoadPlugin "olsrd_watchdog.so.0.1"
|
||||
+{
|
||||
+ PlParam "file" "/tmp/olsrd.watchdog"
|
||||
+ PlParam "interval" "5"
|
||||
+}
|
||||
+
|
||||
+
|
||||
+---------------------------------------------------------------------
|
||||
+EOF / 26.05.2005
|
||||
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
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.c 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.c 2009-03-16 16:51:34.000000000 +0000
|
||||
@@ -0,0 +1,145 @@
|
||||
+
|
||||
+/*
|
||||
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||
+ * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in
|
||||
+ * the documentation and/or other materials provided with the
|
||||
+ * distribution.
|
||||
+ * * Neither the name of olsr.org, olsrd nor the names of its
|
||||
+ * contributors may be used to endorse or promote products derived
|
||||
+ * from this software without specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
+ * POSSIBILITY OF SUCH DAMAGE.
|
||||
+ *
|
||||
+ * Visit http://www.olsr.org for more information.
|
||||
+ *
|
||||
+ * If you find this software useful feel free to make a donation
|
||||
+ * to the project. For more information see the website or contact
|
||||
+ * the copyright holders.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+ /*
|
||||
+ * Example plugin for olsrd.org OLSR daemon
|
||||
+ * Only the bare minimum
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+#include "olsrd_plugin.h"
|
||||
+#include "plugin_util.h"
|
||||
+#include "olsr.h"
|
||||
+#include "defs.h"
|
||||
+#include "scheduler.h"
|
||||
+#include "olsr_cookie.h"
|
||||
+
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <time.h>
|
||||
+#define PLUGIN_INTERFACE_VERSION 5
|
||||
+
|
||||
+static struct olsr_cookie_info *watchdog_timer_cookie;
|
||||
+
|
||||
+static char watchdog_filename[FILENAME_MAX + 1] = "/tmp/olsr.watchdog";
|
||||
+static int watchdog_interval = 5;
|
||||
+
|
||||
+/**
|
||||
+ * Plugin interface version
|
||||
+ * Used by main olsrd to check plugin interface version
|
||||
+ */
|
||||
+int
|
||||
+olsrd_plugin_interface_version(void)
|
||||
+{
|
||||
+ return PLUGIN_INTERFACE_VERSION;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+set_watchdog_file(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon __attribute__ ((unused)))
|
||||
+{
|
||||
+ strncpy(watchdog_filename, value, FILENAME_MAX);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+set_watchdog_interval(const char *value, void *data __attribute__ ((unused)), set_plugin_parameter_addon addon
|
||||
+ __attribute__ ((unused)))
|
||||
+{
|
||||
+ watchdog_interval = atoi(value);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Register parameters from config file
|
||||
+ * Called for all plugin parameters
|
||||
+ */
|
||||
+static const struct olsrd_plugin_parameters plugin_parameters[] = {
|
||||
+ {.name = "file",.set_plugin_parameter = &set_watchdog_file,.data = NULL},
|
||||
+ {.name = "interval",.set_plugin_parameter = &set_watchdog_interval,.data = NULL},
|
||||
+};
|
||||
+
|
||||
+void
|
||||
+olsrd_get_plugin_parameters(const struct olsrd_plugin_parameters **params, int *size)
|
||||
+{
|
||||
+ *params = plugin_parameters;
|
||||
+ *size = ARRAYSIZE(plugin_parameters);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+olsr_watchdog_write_alivefile(void *foo __attribute__ ((unused)))
|
||||
+{
|
||||
+ FILE *file = fopen(watchdog_filename, "w");
|
||||
+ if (file == NULL) {
|
||||
+ OLSR_PRINTF(3, "Error, cannot write watchdog alivefile");
|
||||
+ } else {
|
||||
+ fprintf(file, "%ld\n", (long)time(NULL));
|
||||
+ fflush(file);
|
||||
+ fclose(file);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Initialize plugin
|
||||
+ * Called after all parameters are passed
|
||||
+ */
|
||||
+int
|
||||
+olsrd_plugin_init(void)
|
||||
+{
|
||||
+ /* create the cookie */
|
||||
+ watchdog_timer_cookie = olsr_alloc_cookie("Watchdog: write alive-file", OLSR_COOKIE_TYPE_TIMER);
|
||||
+
|
||||
+ /* Register the GW check */
|
||||
+ olsr_start_timer(watchdog_interval * MSEC_PER_SEC, 0, OLSR_TIMER_PERIODIC,
|
||||
+ &olsr_watchdog_write_alivefile, NULL, watchdog_timer_cookie->ci_id);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Local Variables:
|
||||
+ * c-basic-offset: 2
|
||||
+ * indent-tabs-mode: nil
|
||||
+ * End:
|
||||
+ */
|
||||
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
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/src/olsrd_plugin.h 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/src/olsrd_plugin.h 2009-03-13 17:13:45.000000000 +0000
|
||||
@@ -0,0 +1,69 @@
|
||||
+
|
||||
+/*
|
||||
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||
+ * Copyright (c) 2004-2009, the olsr.org team - see HISTORY file
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ *
|
||||
+ * * Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * * Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in
|
||||
+ * the documentation and/or other materials provided with the
|
||||
+ * distribution.
|
||||
+ * * Neither the name of olsr.org, olsrd nor the names of its
|
||||
+ * contributors may be used to endorse or promote products derived
|
||||
+ * from this software without specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
+ * POSSIBILITY OF SUCH DAMAGE.
|
||||
+ *
|
||||
+ * Visit http://www.olsr.org for more information.
|
||||
+ *
|
||||
+ * If you find this software useful feel free to make a donation
|
||||
+ * to the project. For more information see the website or contact
|
||||
+ * the copyright holders.
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+/*
|
||||
+ * Dynamic linked library for the olsr.org olsr daemon
|
||||
+ */
|
||||
+
|
||||
+#ifndef _OLSRD_PLUGIN_MINI
|
||||
+#define _OLSRD_PLUGIN_MINI
|
||||
+
|
||||
+
|
||||
+/****************************************************************************
|
||||
+ * Functions that the plugin MUST provide *
|
||||
+ ****************************************************************************/
|
||||
+
|
||||
+
|
||||
+/* Initialization function */
|
||||
+int
|
||||
+ olsrd_plugin_init(void);
|
||||
+
|
||||
+int
|
||||
+ olsrd_plugin_interface_version(void);
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Local Variables:
|
||||
+ * c-basic-offset: 2
|
||||
+ * indent-tabs-mode: nil
|
||||
+ * End:
|
||||
+ */
|
||||
diff -Nur olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/version-script.txt olsrd-0-5-6-fc691af9a18d/lib/watchdog/version-script.txt
|
||||
--- olsrd-0-5-6-fc691af9a18d.orig/lib/watchdog/version-script.txt 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ olsrd-0-5-6-fc691af9a18d/lib/watchdog/version-script.txt 2009-03-13 17:13:45.000000000 +0000
|
||||
@@ -0,0 +1,10 @@
|
||||
+VERS_1.0
|
||||
+{
|
||||
+ global:
|
||||
+ olsrd_plugin_interface_version;
|
||||
+ olsrd_plugin_init;
|
||||
+ olsrd_get_plugin_parameters;
|
||||
+
|
||||
+ local:
|
||||
+ *;
|
||||
+};
|
Loading…
Reference in a new issue