merge olsrd changes with freifunks code changes. compiles completely, but have not tested with an actually mesh.
git-svn-id: svn://svn.openwrt.org/openwrt/packages@6273 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
d7c63088c1
commit
07e70aee64
9
net/olsrd/patches/110-olsrd-libsmake.patch
Normal file
9
net/olsrd/patches/110-olsrd-libsmake.patch
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/Makefile olsrd-0.4.10/lib/Makefile
|
||||||
|
--- olsrd-0.4.10.orig/lib/Makefile 2005-05-26 18:09:25.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/lib/Makefile 2006-12-01 08:18:12.000000000 +0100
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-SUBDIRS = dot_draw dyn_gw httpinfo mini nameservice powerinfo secure tas
|
||||||
|
+SUBDIRS = $(shell find -maxdepth 1 -type d -not -name ".*" -not -name "CVS" -printf "%f\n")
|
||||||
|
|
||||||
|
.PHONY: $(SUBDIRS)
|
||||||
|
|
364
net/olsrd/patches/120-olsrd-dyngwplain.patch
Normal file
364
net/olsrd/patches/120-olsrd-dyngwplain.patch
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/dyn_gw_plain/Makefile olsrd-0.4.10/lib/dyn_gw_plain/Makefile
|
||||||
|
--- olsrd-0.4.10.orig/lib/dyn_gw_plain/Makefile 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dyn_gw_plain/Makefile 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+# The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+# Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+# 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.
|
||||||
|
+#
|
||||||
|
+# $Id: olsrd-dyngwplain.patch,v 1.5 2006/12/04 08:33:46 sven-ola Exp $
|
||||||
|
+
|
||||||
|
+OLSRD_PLUGIN = true
|
||||||
|
+PLUGIN_NAME = olsrd_dyn_gw_plain
|
||||||
|
+PLUGIN_VER = 0.4
|
||||||
|
+
|
||||||
|
+TOPDIR = ../..
|
||||||
|
+include $(TOPDIR)/Makefile.inc
|
||||||
|
+
|
||||||
|
+default_target: $(PLUGIN_FULLNAME)
|
||||||
|
+
|
||||||
|
+$(PLUGIN_FULLNAME): $(OBJS)
|
||||||
|
+ $(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.4.10.orig/lib/dyn_gw_plain/README_DYN_GW_PLAIN olsrd-0.4.10/lib/dyn_gw_plain/README_DYN_GW_PLAIN
|
||||||
|
--- olsrd-0.4.10.orig/lib/dyn_gw_plain/README_DYN_GW_PLAIN 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dyn_gw_plain/README_DYN_GW_PLAIN 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,17 @@
|
||||||
|
+DYNAMIC INTERNET GATEWAY PLAIN PLUGIN FOR olsr.org olsrd
|
||||||
|
+by Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+additions by Sven-Ola Tuecke
|
||||||
|
+
|
||||||
|
+This plugin is without Ping/libthread. It is the plain dyn_gw!
|
||||||
|
+
|
||||||
|
+HOW TO USE
|
||||||
|
+
|
||||||
|
+Add an entry like this to your olsrd configuration file:
|
||||||
|
+
|
||||||
|
+LoadPlugin "olsrd_dyn_gw_plain.so.0.4"
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+ABOUT
|
||||||
|
+
|
||||||
|
+Plugin is IPv4 only.
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.c olsrd-0.4.10/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.c 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,186 @@
|
||||||
|
+/*
|
||||||
|
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+ * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+ * 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "olsr_types.h"
|
||||||
|
+#include "olsrd_dyn_gw_plain.h"
|
||||||
|
+#include "scheduler.h"
|
||||||
|
+#include "olsr.h"
|
||||||
|
+#include "local_hna_set.h"
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <net/route.h>
|
||||||
|
+#include <linux/in_route.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+
|
||||||
|
+#define DEBUGLEV 1
|
||||||
|
+
|
||||||
|
+static int has_inet_gateway;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Plugin interface version
|
||||||
|
+ * Used by main olsrd to check plugin interface version
|
||||||
|
+ */
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_interface_version()
|
||||||
|
+{
|
||||||
|
+ return OLSRD_PLUGIN_INTERFACE_VERSION;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Register parameters from config file
|
||||||
|
+ * Called for all plugin parameters
|
||||||
|
+ */
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_register_param(char *key, char *value)
|
||||||
|
+{
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Initialize plugin
|
||||||
|
+ * Called after all parameters are passed
|
||||||
|
+ */
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_init()
|
||||||
|
+{
|
||||||
|
+ gw_net.v4 = INET_NET;
|
||||||
|
+ gw_netmask.v4 = INET_PREFIX;
|
||||||
|
+
|
||||||
|
+ has_inet_gateway = 0;
|
||||||
|
+
|
||||||
|
+ /* Remove all local Inet HNA entries */
|
||||||
|
+ while(remove_local_hna4_entry(&gw_net, &gw_netmask)) {
|
||||||
|
+ olsr_printf(DEBUGLEV, "HNA Internet gateway deleted\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Register the GW check */
|
||||||
|
+ olsr_register_scheduler_event(&olsr_event, NULL, 3, 4, NULL);
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+check_gw(union olsr_ip_addr *net, union olsr_ip_addr *mask)
|
||||||
|
+{
|
||||||
|
+ char buff[1024], iface[16];
|
||||||
|
+ olsr_u32_t gate_addr, dest_addr, netmask;
|
||||||
|
+ unsigned int iflags;
|
||||||
|
+ int num, metric, refcnt, use;
|
||||||
|
+ int retval = 0;
|
||||||
|
+
|
||||||
|
+ FILE *fp = fopen(PROCENTRY_ROUTE, "r");
|
||||||
|
+
|
||||||
|
+ if (!fp)
|
||||||
|
+ {
|
||||||
|
+ perror(PROCENTRY_ROUTE);
|
||||||
|
+ olsr_printf(DEBUGLEV, "INET (IPv4) not configured in this system.\n");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rewind(fp);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ olsr_printf(DEBUGLEV, "Genmask Destination Gateway "
|
||||||
|
+ "Flags Metric Ref Use Iface\n");
|
||||||
|
+ /**/
|
||||||
|
+ while (fgets(buff, 1023, fp))
|
||||||
|
+ {
|
||||||
|
+ num = sscanf(buff, "%16s %128X %128X %X %d %d %d %128X \n",
|
||||||
|
+ iface, &dest_addr, &gate_addr,
|
||||||
|
+ &iflags, &refcnt, &use, &metric, &netmask);
|
||||||
|
+
|
||||||
|
+ if (num < 8)
|
||||||
|
+ {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ olsr_printf(DEBUGLEV, "%-15s ", olsr_ip_to_string((union olsr_ip_addr *)&netmask));
|
||||||
|
+
|
||||||
|
+ olsr_printf(DEBUGLEV, "%-15s ", olsr_ip_to_string((union olsr_ip_addr *)&dest_addr));
|
||||||
|
+
|
||||||
|
+ olsr_printf(DEBUGLEV, "%-15s %-6d %-2d %7d %s\n",
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&gate_addr),
|
||||||
|
+ metric, refcnt, use, iface);
|
||||||
|
+ /**/
|
||||||
|
+
|
||||||
|
+ if(//(iflags & RTF_GATEWAY) &&
|
||||||
|
+ (iflags & RTF_UP) &&
|
||||||
|
+ (metric == 0) &&
|
||||||
|
+ (netmask == mask->v4) &&
|
||||||
|
+ (dest_addr == net->v4))
|
||||||
|
+ {
|
||||||
|
+ olsr_printf(DEBUGLEV, "INTERNET GATEWAY VIA %s detected in routing table.\n", iface);
|
||||||
|
+ retval=1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fclose(fp);
|
||||||
|
+
|
||||||
|
+ if(retval == 0)
|
||||||
|
+ {
|
||||||
|
+ olsr_printf(DEBUGLEV, "No Internet GWs detected...\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Scheduled event to update the hna table,
|
||||||
|
+ * called from olsrd main thread to keep the hna table thread-safe
|
||||||
|
+ */
|
||||||
|
+void olsr_event(void* foo)
|
||||||
|
+{
|
||||||
|
+ int res = check_gw(&gw_net, &gw_netmask);
|
||||||
|
+ if (1 == res && 0 == has_inet_gateway) {
|
||||||
|
+ olsr_printf(DEBUGLEV, "Adding OLSR local HNA entry for Internet\n");
|
||||||
|
+ add_local_hna4_entry(&gw_net, &gw_netmask);
|
||||||
|
+ has_inet_gateway = 1;
|
||||||
|
+ }
|
||||||
|
+ else if (0 == res && 1 == has_inet_gateway) {
|
||||||
|
+ /* Remove all local Inet HNA entries */
|
||||||
|
+ while(remove_local_hna4_entry(&gw_net, &gw_netmask)) {
|
||||||
|
+ olsr_printf(DEBUGLEV, "Removing OLSR local HNA entry for Internet\n");
|
||||||
|
+ }
|
||||||
|
+ has_inet_gateway = 0;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.h olsrd-0.4.10/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.h
|
||||||
|
--- olsrd-0.4.10.orig/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dyn_gw_plain/src/olsrd_dyn_gw_plain.h 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,59 @@
|
||||||
|
+/*
|
||||||
|
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+ * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+ * 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef _OLSRD_PLUGIN_TEST
|
||||||
|
+#define _OLSRD_PLUGIN_TEST
|
||||||
|
+
|
||||||
|
+#include "olsrd_plugin.h"
|
||||||
|
+#include "olsr.h"
|
||||||
|
+
|
||||||
|
+#define INET_NET 0
|
||||||
|
+#define INET_PREFIX 0
|
||||||
|
+
|
||||||
|
+#define PROCENTRY_ROUTE "/proc/net/route"
|
||||||
|
+
|
||||||
|
+union olsr_ip_addr gw_net;
|
||||||
|
+union olsr_ip_addr gw_netmask;
|
||||||
|
+
|
||||||
|
+int check_gw(union olsr_ip_addr *net, union olsr_ip_addr *mask);
|
||||||
|
+
|
||||||
|
+/* Event function to register with the scheduler */
|
||||||
|
+void olsr_event(void* foo);
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/dyn_gw_plain/version-script.txt olsrd-0.4.10/lib/dyn_gw_plain/version-script.txt
|
||||||
|
--- olsrd-0.4.10.orig/lib/dyn_gw_plain/version-script.txt 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dyn_gw_plain/version-script.txt 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,10 @@
|
||||||
|
+VERS_1.0
|
||||||
|
+{
|
||||||
|
+ global:
|
||||||
|
+ olsrd_plugin_interface_version;
|
||||||
|
+ olsrd_plugin_register_param;
|
||||||
|
+ olsrd_plugin_init;
|
||||||
|
+
|
||||||
|
+ local:
|
||||||
|
+ *;
|
||||||
|
+};
|
||||||
|
diff -Nur olsrd-0.4.10.orig/Makefile olsrd-0.4.10/Makefile
|
||||||
|
--- olsrd-0.4.10.orig/Makefile 2006-01-04 09:45:38.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/Makefile 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -144,6 +144,11 @@
|
||||||
|
$(MAKE) -C lib/dyn_gw
|
||||||
|
$(MAKE) -C lib/dyn_gw install
|
||||||
|
|
||||||
|
+dyn_gw_plain:
|
||||||
|
+ $(MAKE) -C lib/dyn_gw_plain clean
|
||||||
|
+ $(MAKE) -C lib/dyn_gw_plain
|
||||||
|
+ $(MAKE) -C lib/dyn_gw_plain install
|
||||||
|
+
|
||||||
|
powerinfo:
|
||||||
|
$(MAKE) -C lib/powerinfo clean
|
||||||
|
$(MAKE) -C lib/powerinfo
|
@ -1,12 +0,0 @@
|
|||||||
diff -ruN olsrd-0.4.9-orig/lib/secure/src/olsrd_secure.h olsrd-0.4.9-1/lib/secure/src/olsrd_secure.h
|
|
||||||
--- olsrd-0.4.9-orig/lib/secure/src/olsrd_secure.h 2005-03-10 20:57:48.000000000 +0100
|
|
||||||
+++ olsrd-0.4.9-1/lib/secure/src/olsrd_secure.h 2005-04-05 00:51:40.000000000 +0200
|
|
||||||
@@ -43,7 +43,7 @@
|
|
||||||
|
|
||||||
#include "olsrd_plugin.h"
|
|
||||||
|
|
||||||
-#define KEYFILE "/root/.olsr/olsrd_secure_key"
|
|
||||||
+#define KEYFILE "/etc/olsrd.d/olsrd_secure_key"
|
|
||||||
|
|
||||||
/* Schemes */
|
|
||||||
#define ONE_CHECKSUM 1
|
|
1287
net/olsrd/patches/130-olsrd-nameservice+services.patch
Normal file
1287
net/olsrd/patches/130-olsrd-nameservice+services.patch
Normal file
File diff suppressed because it is too large
Load Diff
853
net/olsrd/patches/140-olsrd-txtinfo.patch
Normal file
853
net/olsrd/patches/140-olsrd-txtinfo.patch
Normal file
@ -0,0 +1,853 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/txtinfo/Makefile olsrd-0.4.10/lib/txtinfo/Makefile
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/Makefile 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/Makefile 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,57 @@
|
||||||
|
+# The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+# Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+# 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.
|
||||||
|
+#
|
||||||
|
+# $Id: olsrd-txtinfo.patch,v 1.5 2006/12/04 08:33:46 sven-ola Exp $
|
||||||
|
+
|
||||||
|
+OLSRD_PLUGIN = true
|
||||||
|
+PLUGIN_NAME = olsrd_txtinfo
|
||||||
|
+PLUGIN_VER = 0.1
|
||||||
|
+
|
||||||
|
+TOPDIR = ../..
|
||||||
|
+include $(TOPDIR)/Makefile.inc
|
||||||
|
+
|
||||||
|
+default_target: $(PLUGIN_FULLNAME)
|
||||||
|
+
|
||||||
|
+$(PLUGIN_FULLNAME): $(OBJS)
|
||||||
|
+ $(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.4.10.orig/lib/txtinfo/README_TXTINFO olsrd-0.4.10/lib/txtinfo/README_TXTINFO
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/README_TXTINFO 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/README_TXTINFO 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+LoadPlugin "olsrd_txtinfo.so.0.1"
|
||||||
|
+{
|
||||||
|
+ PlParam "accept" "10.247.200.4"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+ABOUT
|
||||||
|
+
|
||||||
|
+telnet 127.0.0.1 2006
|
||||||
|
+or
|
||||||
|
+wget localhost:2006 -qO -
|
||||||
|
+
|
||||||
|
+installation:
|
||||||
|
+make
|
||||||
|
+make install
|
||||||
|
+
|
||||||
|
+- Lorenz Schori
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_plugin.c olsrd-0.4.10/lib/txtinfo/src/olsrd_plugin.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_plugin.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/src/olsrd_plugin.c 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,142 @@
|
||||||
|
+/*
|
||||||
|
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+ * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+ * 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.
|
||||||
|
+ *
|
||||||
|
+ * $Id: olsrd-txtinfo.patch,v 1.5 2006/12/04 08:33:46 sven-ola Exp $
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Dynamic linked library for the olsr.org olsr daemon
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <arpa/inet.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <netinet/in.h>
|
||||||
|
+
|
||||||
|
+#include "olsrd_plugin.h"
|
||||||
|
+#include "olsrd_txtinfo.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#define PLUGIN_NAME "OLSRD txtinfo plugin"
|
||||||
|
+#define PLUGIN_VERSION "0.1"
|
||||||
|
+#define PLUGIN_AUTHOR "Lorenz Schori"
|
||||||
|
+#define MOD_DESC PLUGIN_NAME " " PLUGIN_VERSION " by " PLUGIN_AUTHOR
|
||||||
|
+#define PLUGIN_INTERFACE_VERSION 4
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+struct in_addr ipc_accept_ip;
|
||||||
|
+int ipc_port;
|
||||||
|
+int nompr;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void __attribute__ ((constructor))
|
||||||
|
+my_init(void);
|
||||||
|
+
|
||||||
|
+static void __attribute__ ((destructor))
|
||||||
|
+my_fini(void);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ *Constructor
|
||||||
|
+ */
|
||||||
|
+static void
|
||||||
|
+my_init()
|
||||||
|
+{
|
||||||
|
+ /* Print plugin info to stdout */
|
||||||
|
+ printf("%s\n", MOD_DESC);
|
||||||
|
+
|
||||||
|
+ /* defaults for parameters */
|
||||||
|
+ ipc_port = 2006;
|
||||||
|
+ ipc_accept_ip.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
|
+
|
||||||
|
+ /* highlite neighbours by default */
|
||||||
|
+ nompr = 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ *Destructor
|
||||||
|
+ */
|
||||||
|
+static void
|
||||||
|
+my_fini()
|
||||||
|
+{
|
||||||
|
+ /* Calls the destruction function
|
||||||
|
+ * olsr_plugin_exit()
|
||||||
|
+ * This function should be present in your
|
||||||
|
+ * sourcefile and all data destruction
|
||||||
|
+ * should happen there - NOT HERE!
|
||||||
|
+ */
|
||||||
|
+ olsr_plugin_exit();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_interface_version()
|
||||||
|
+{
|
||||||
|
+ return PLUGIN_INTERFACE_VERSION;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_register_param(char *key, char *value)
|
||||||
|
+{
|
||||||
|
+ if(!strcmp(key, "port"))
|
||||||
|
+ {
|
||||||
|
+ ipc_port = atoi(value);
|
||||||
|
+ printf("(TXTINFO) listening on port: %d\n", ipc_port);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if(!strcmp(key, "accept"))
|
||||||
|
+ {
|
||||||
|
+ inet_aton(value, &ipc_accept_ip);
|
||||||
|
+ printf("(TXTINFO) accept only: %s\n", inet_ntoa(ipc_accept_ip));
|
||||||
|
+ }
|
||||||
|
+/*
|
||||||
|
+ if(!strcmp(key, "hilitemprneighbours"))
|
||||||
|
+ {
|
||||||
|
+ if(!strcmp(value, "false") || !strcmp(value, "0"))
|
||||||
|
+ {
|
||||||
|
+ nompr=1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ */
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_txtinfo.c olsrd-0.4.10/lib/txtinfo/src/olsrd_txtinfo.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_txtinfo.c 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/src/olsrd_txtinfo.c 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,542 @@
|
||||||
|
+/*
|
||||||
|
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+ * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+ * includes code by Bruno Randolf
|
||||||
|
+ * includes code by Andreas Lopatic
|
||||||
|
+ * includes code by Sven-Ola Tuecke
|
||||||
|
+ * includes code by Lorenz Schori
|
||||||
|
+ * 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.
|
||||||
|
+ *
|
||||||
|
+ * $Id: olsrd-txtinfo.patch,v 1.5 2006/12/04 08:33:46 sven-ola Exp $
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Dynamic linked library for the olsr.org olsr daemon
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <sys/socket.h>
|
||||||
|
+#include <sys/select.h>
|
||||||
|
+#include <netinet/in.h>
|
||||||
|
+#include <arpa/inet.h>
|
||||||
|
+#include <sys/time.h>
|
||||||
|
+#include <time.h>
|
||||||
|
+#include <math.h>
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+#include <stdarg.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
+
|
||||||
|
+#include "olsr.h"
|
||||||
|
+#include "olsr_types.h"
|
||||||
|
+#include "neighbor_table.h"
|
||||||
|
+#include "two_hop_neighbor_table.h"
|
||||||
|
+#include "mpr_selector_set.h"
|
||||||
|
+#include "tc_set.h"
|
||||||
|
+#include "hna_set.h"
|
||||||
|
+#include "mid_set.h"
|
||||||
|
+#include "link_set.h"
|
||||||
|
+#include "socket_parser.h"
|
||||||
|
+
|
||||||
|
+#include "olsrd_txtinfo.h"
|
||||||
|
+#include "olsrd_plugin.h"
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#ifdef WIN32
|
||||||
|
+#define close(x) closesocket(x)
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int ipc_socket;
|
||||||
|
+static int ipc_open;
|
||||||
|
+static int ipc_connection;
|
||||||
|
+static int ipc_socket_up;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/* IPC initialization function */
|
||||||
|
+static int
|
||||||
|
+plugin_ipc_init(void);
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+send_info(int neighonly);
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+ipc_action(int);
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_neigh_link(void);
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_routes(void);
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_topology(void);
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_hna(void);
|
||||||
|
+
|
||||||
|
+#define TXT_IPC_BUFSIZE 256
|
||||||
|
+static int
|
||||||
|
+ipc_sendf(const char* format, ...);
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ *Do initialization here
|
||||||
|
+ *
|
||||||
|
+ *This function is called by the my_init
|
||||||
|
+ *function in uolsrd_plugin.c
|
||||||
|
+ */
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_init()
|
||||||
|
+{
|
||||||
|
+ /* Initial IPC value */
|
||||||
|
+ ipc_open = 0;
|
||||||
|
+ ipc_socket_up = 0;
|
||||||
|
+
|
||||||
|
+ plugin_ipc_init();
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * destructor - called at unload
|
||||||
|
+ */
|
||||||
|
+void
|
||||||
|
+olsr_plugin_exit()
|
||||||
|
+{
|
||||||
|
+ if(ipc_open)
|
||||||
|
+ close(ipc_socket);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+plugin_ipc_init()
|
||||||
|
+{
|
||||||
|
+ struct sockaddr_in sin;
|
||||||
|
+ olsr_u32_t yes = 1;
|
||||||
|
+
|
||||||
|
+ /* Init ipc socket */
|
||||||
|
+ if ((ipc_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
|
||||||
|
+ {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) socket()=%s\n", strerror(errno));
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (setsockopt(ipc_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0)
|
||||||
|
+ {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) setsockopt()=%s\n", strerror(errno));
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+#if defined __FreeBSD__ && defined SO_NOSIGPIPE
|
||||||
|
+ if (setsockopt(ipc_socket, SOL_SOCKET, SO_NOSIGPIPE, (char *)&yes, sizeof(yes)) < 0)
|
||||||
|
+ {
|
||||||
|
+ perror("SO_REUSEADDR failed");
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ /* Bind the socket */
|
||||||
|
+
|
||||||
|
+ /* complete the socket structure */
|
||||||
|
+ memset(&sin, 0, sizeof(sin));
|
||||||
|
+ sin.sin_family = AF_INET;
|
||||||
|
+ sin.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
+ sin.sin_port = htons(ipc_port);
|
||||||
|
+
|
||||||
|
+ /* bind the socket to the port number */
|
||||||
|
+ if (bind(ipc_socket, (struct sockaddr *) &sin, sizeof(sin)) == -1)
|
||||||
|
+ {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) bind()=%s\n", strerror(errno));
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* show that we are willing to listen */
|
||||||
|
+ if (listen(ipc_socket, 1) == -1)
|
||||||
|
+ {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) listen()=%s\n", strerror(errno));
|
||||||
|
+#endif
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Register with olsrd */
|
||||||
|
+ add_olsr_socket(ipc_socket, &ipc_action);
|
||||||
|
+
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(2, "(TXTINFO) listening on port %d\n",ipc_port);
|
||||||
|
+#endif
|
||||||
|
+ ipc_socket_up = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+ipc_action(int fd)
|
||||||
|
+{
|
||||||
|
+ struct sockaddr_in pin;
|
||||||
|
+ socklen_t addrlen;
|
||||||
|
+ char *addr;
|
||||||
|
+
|
||||||
|
+ addrlen = sizeof(struct sockaddr_in);
|
||||||
|
+
|
||||||
|
+ if(ipc_open)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if ((ipc_connection = accept(fd, (struct sockaddr *) &pin, &addrlen)) == -1)
|
||||||
|
+ {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) accept()=%s\n", strerror(errno));
|
||||||
|
+#endif
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ addr = inet_ntoa(pin.sin_addr);
|
||||||
|
+ if(ntohl(pin.sin_addr.s_addr) != ntohl(ipc_accept_ip.s_addr))
|
||||||
|
+ {
|
||||||
|
+ olsr_printf(1, "(TXTINFO) From host(%s) not allowed!\n", addr);
|
||||||
|
+ close(ipc_connection);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ ipc_open = 1;
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(2, "(TXTINFO) Connect from %s\n",addr);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ /* purge read buffer to prevent blocking on linux*/
|
||||||
|
+ fd_set rfds;
|
||||||
|
+ FD_ZERO(&rfds);
|
||||||
|
+ FD_SET(ipc_connection, &rfds);
|
||||||
|
+ struct timeval tv = {0,0};
|
||||||
|
+ int neighonly = 0;
|
||||||
|
+ if(select(ipc_connection+1, &rfds, NULL, NULL, &tv)) {
|
||||||
|
+ char requ[128];
|
||||||
|
+ ssize_t s = recv(ipc_connection, &requ, sizeof(requ), 0);
|
||||||
|
+ if (0 < s) {
|
||||||
|
+ requ[s] = 0;
|
||||||
|
+ /* To print out neighbours only on the Freifunk Status
|
||||||
|
+ * page the normal output is somewhat lengthy. The
|
||||||
|
+ * header parsing is sufficient for standard wget.
|
||||||
|
+ */
|
||||||
|
+ neighonly = (0 != strstr(requ, "/neighbours"));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ send_info(neighonly);
|
||||||
|
+
|
||||||
|
+ close(ipc_connection);
|
||||||
|
+ ipc_open = 0;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_neigh_link(void)
|
||||||
|
+{
|
||||||
|
+ struct neighbor_entry *neigh;
|
||||||
|
+ struct neighbor_2_list_entry *list_2;
|
||||||
|
+ struct link_entry *link = NULL;
|
||||||
|
+ int index, thop_cnt;
|
||||||
|
+
|
||||||
|
+ ipc_sendf("Table: Links\nLocal IP\tremote IP\tHysteresis\tLinkQuality\tlost\ttotal\tNLQ\tETX\n");
|
||||||
|
+
|
||||||
|
+ /* Link set */
|
||||||
|
+ link = link_set;
|
||||||
|
+ while(link)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%d\t%d\t%0.2f\t%0.2f\t\n",
|
||||||
|
+ olsr_ip_to_string(&link->local_iface_addr),
|
||||||
|
+ olsr_ip_to_string(&link->neighbor_iface_addr),
|
||||||
|
+ link->L_link_quality,
|
||||||
|
+ link->loss_link_quality,
|
||||||
|
+ link->lost_packets,
|
||||||
|
+ link->total_packets,
|
||||||
|
+ link->neigh_link_quality,
|
||||||
|
+ (link->loss_link_quality * link->neigh_link_quality) ? 1.0 / (link->loss_link_quality * link->neigh_link_quality) : 0.0);
|
||||||
|
+ link = link->next;
|
||||||
|
+ }
|
||||||
|
+ ipc_sendf("\nTable: Neighbors\nIP address\tSYM\tMPR\tMPRS\tWillingness\t2 Hop Neighbors\n");
|
||||||
|
+
|
||||||
|
+ /* Neighbors */
|
||||||
|
+ for(index=0;index<HASHSIZE;index++)
|
||||||
|
+ {
|
||||||
|
+ for(neigh = neighbortable[index].next;
|
||||||
|
+ neigh != &neighbortable[index];
|
||||||
|
+ neigh = neigh->next)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf(
|
||||||
|
+ "%s\t%s\t%s\t%s\t%d\t",
|
||||||
|
+ olsr_ip_to_string(&neigh->neighbor_main_addr),
|
||||||
|
+ (neigh->status == SYM) ? "YES" : "NO",
|
||||||
|
+ neigh->is_mpr ? "YES" : "NO",
|
||||||
|
+ olsr_lookup_mprs_set(&neigh->neighbor_main_addr) ? "YES" : "NO",
|
||||||
|
+ neigh->willingness);
|
||||||
|
+
|
||||||
|
+ thop_cnt = 0;
|
||||||
|
+
|
||||||
|
+ for(list_2 = neigh->neighbor_2_list.next;
|
||||||
|
+ list_2 != &neigh->neighbor_2_list;
|
||||||
|
+ list_2 = list_2->next)
|
||||||
|
+ {
|
||||||
|
+ //size += sprintf(&buf[size], "<option>%s</option>\n", olsr_ip_to_string(&list_2->neighbor_2->neighbor_2_addr));
|
||||||
|
+ thop_cnt ++;
|
||||||
|
+ }
|
||||||
|
+ ipc_sendf("%d\n", thop_cnt);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ipc_sendf("\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_routes(void)
|
||||||
|
+{
|
||||||
|
+ int size = 0, index;
|
||||||
|
+ struct rt_entry *routes;
|
||||||
|
+
|
||||||
|
+ ipc_sendf("Table: Routes\nDestination\tGateway\tMetric\tETX\tInterface\tType\n");
|
||||||
|
+
|
||||||
|
+ /* Neighbors */
|
||||||
|
+ for(index = 0;index < HASHSIZE;index++)
|
||||||
|
+ {
|
||||||
|
+ for(routes = routingtable[index].next;
|
||||||
|
+ routes != &routingtable[index];
|
||||||
|
+ routes = routes->next)
|
||||||
|
+ {
|
||||||
|
+ size = 0;
|
||||||
|
+ ipc_sendf( "%s\t%s\t%d\t%.2f\t%s\tHOST\n",
|
||||||
|
+ olsr_ip_to_string(&routes->rt_dst),
|
||||||
|
+ olsr_ip_to_string(&routes->rt_router),
|
||||||
|
+ routes->rt_metric,
|
||||||
|
+ routes->rt_etx,
|
||||||
|
+ routes->rt_if->int_name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* HNA */
|
||||||
|
+ for(index = 0;index < HASHSIZE;index++)
|
||||||
|
+ {
|
||||||
|
+ for(routes = hna_routes[index].next;
|
||||||
|
+ routes != &hna_routes[index];
|
||||||
|
+ routes = routes->next)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf("%s\t%s\t%d\t%s\t\tHNA\n",
|
||||||
|
+ olsr_ip_to_string(&routes->rt_dst),
|
||||||
|
+ olsr_ip_to_string(&routes->rt_router),
|
||||||
|
+ routes->rt_metric,
|
||||||
|
+ routes->rt_if->int_name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ipc_sendf("\n");
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_topology(void)
|
||||||
|
+{
|
||||||
|
+ olsr_u8_t index;
|
||||||
|
+ struct tc_entry *entry;
|
||||||
|
+ struct topo_dst *dst_entry;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ ipc_sendf("Table: Topology\nDestination IP\tLast hop IP\tLQ\tILQ\tETX\n");
|
||||||
|
+
|
||||||
|
+ /* Topology */
|
||||||
|
+ for(index=0;index<HASHSIZE;index++)
|
||||||
|
+ {
|
||||||
|
+ /* For all TC entries */
|
||||||
|
+ entry = tc_table[index].next;
|
||||||
|
+ while(entry != &tc_table[index])
|
||||||
|
+ {
|
||||||
|
+ /* For all destination entries of that TC entry */
|
||||||
|
+ dst_entry = entry->destinations.next;
|
||||||
|
+ while(dst_entry != &entry->destinations)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf( "%s\t%s\t%0.2f\t%0.2f\t%0.2f\n",
|
||||||
|
+ olsr_ip_to_string(&dst_entry->T_dest_addr),
|
||||||
|
+ olsr_ip_to_string(&entry->T_last_addr),
|
||||||
|
+ dst_entry->link_quality,
|
||||||
|
+ dst_entry->inverse_link_quality,
|
||||||
|
+ (dst_entry->link_quality * dst_entry->inverse_link_quality) ? 1.0 / (dst_entry->link_quality * dst_entry->inverse_link_quality) : 0.0);
|
||||||
|
+
|
||||||
|
+ dst_entry = dst_entry->next;
|
||||||
|
+ }
|
||||||
|
+ entry = entry->next;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ipc_sendf("\n");
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void inline
|
||||||
|
+ipc_print_hna(void)
|
||||||
|
+{
|
||||||
|
+ int size;
|
||||||
|
+ olsr_u8_t index;
|
||||||
|
+ struct hna_entry *tmp_hna;
|
||||||
|
+ struct hna_net *tmp_net;
|
||||||
|
+
|
||||||
|
+ size = 0;
|
||||||
|
+
|
||||||
|
+ ipc_sendf("Table: HNA\nNetwork\tNetmask\tGateway\n");
|
||||||
|
+
|
||||||
|
+ /* Announced HNA entries */
|
||||||
|
+ struct hna4_entry *hna4;
|
||||||
|
+ for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf("%s\t%s\t%s\n",
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&hna4->net),
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&hna4->netmask),
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&main_addr));
|
||||||
|
+ }
|
||||||
|
+ struct hna6_entry *hna6;
|
||||||
|
+ for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next)
|
||||||
|
+ {
|
||||||
|
+ ipc_sendf("%s\t%d\t%s\n",
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&hna6->net),
|
||||||
|
+ hna6->prefix_len,
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&main_addr));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* HNA entries */
|
||||||
|
+ for(index=0;index<HASHSIZE;index++)
|
||||||
|
+ {
|
||||||
|
+ tmp_hna = hna_set[index].next;
|
||||||
|
+ /* Check all entrys */
|
||||||
|
+ while(tmp_hna != &hna_set[index])
|
||||||
|
+ {
|
||||||
|
+ /* Check all networks */
|
||||||
|
+ tmp_net = tmp_hna->networks.next;
|
||||||
|
+
|
||||||
|
+ while(tmp_net != &tmp_hna->networks)
|
||||||
|
+ {
|
||||||
|
+ if (AF_INET == olsr_cnf->ip_version) {
|
||||||
|
+ ipc_sendf("%s\t%s\t%s\n",
|
||||||
|
+ olsr_ip_to_string(&tmp_net->A_network_addr),
|
||||||
|
+ olsr_ip_to_string((union olsr_ip_addr *)&tmp_net->A_netmask.v4),
|
||||||
|
+ olsr_ip_to_string(&tmp_hna->A_gateway_addr));
|
||||||
|
+ }
|
||||||
|
+ else {
|
||||||
|
+ ipc_sendf("%s\t%d\t%s\n",
|
||||||
|
+ olsr_ip_to_string(&tmp_net->A_network_addr),
|
||||||
|
+ tmp_net->A_netmask.v6,
|
||||||
|
+ olsr_ip_to_string(&tmp_hna->A_gateway_addr));
|
||||||
|
+ }
|
||||||
|
+ tmp_net = tmp_net->next;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ tmp_hna = tmp_hna->next;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ipc_sendf("\n");
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+send_info(int neighonly)
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ /* Print minimal http header */
|
||||||
|
+ ipc_sendf("HTTP/1.0 200 OK\n");
|
||||||
|
+ ipc_sendf("Content-type: text/plain\n\n");
|
||||||
|
+
|
||||||
|
+ /* Print tables to IPC socket */
|
||||||
|
+
|
||||||
|
+ /* links + Neighbors */
|
||||||
|
+ ipc_print_neigh_link();
|
||||||
|
+
|
||||||
|
+ /* topology */
|
||||||
|
+ if (!neighonly) ipc_print_topology();
|
||||||
|
+
|
||||||
|
+ /* hna */
|
||||||
|
+ if (!neighonly) ipc_print_hna();
|
||||||
|
+
|
||||||
|
+ /* routes */
|
||||||
|
+ if (!neighonly) ipc_print_routes();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * In a bigger mesh, there are probs with the fixed
|
||||||
|
+ * bufsize. Because the Content-Length header is
|
||||||
|
+ * optional, the sprintf() is changed to a more
|
||||||
|
+ * scalable solution here.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+ipc_sendf(const char* format, ...)
|
||||||
|
+{
|
||||||
|
+ char txtnetbuf[TXT_IPC_BUFSIZE];
|
||||||
|
+
|
||||||
|
+ va_list arg;
|
||||||
|
+ int rv;
|
||||||
|
+#if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __MacOSX__
|
||||||
|
+ int flags = 0;
|
||||||
|
+#else
|
||||||
|
+ int flags = MSG_NOSIGNAL;
|
||||||
|
+#endif
|
||||||
|
+ va_start(arg, format);
|
||||||
|
+ rv = vsnprintf(txtnetbuf, sizeof(txtnetbuf), format, arg);
|
||||||
|
+ va_end(arg);
|
||||||
|
+ if(ipc_socket_up) {
|
||||||
|
+ if (0 > send(ipc_connection, txtnetbuf, rv, flags)) {
|
||||||
|
+#ifndef NODEBUG
|
||||||
|
+ olsr_printf(1, "(TXTINFO) Failed sending data to client!\n");
|
||||||
|
+#endif
|
||||||
|
+ close(ipc_connection);
|
||||||
|
+ return - 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ return rv;
|
||||||
|
+}
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_txtinfo.h olsrd-0.4.10/lib/txtinfo/src/olsrd_txtinfo.h
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/src/olsrd_txtinfo.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/src/olsrd_txtinfo.h 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,62 @@
|
||||||
|
+/*
|
||||||
|
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
|
||||||
|
+ * Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
+ * includes code by Bruno Randolf
|
||||||
|
+ * 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.
|
||||||
|
+ *
|
||||||
|
+ * $Id: olsrd-txtinfo.patch,v 1.5 2006/12/04 08:33:46 sven-ola Exp $
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Dynamic linked library for the olsr.org olsr daemon
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef _OLSRD_DOT_DRAW
|
||||||
|
+#define _OLSRD_DOT_DRAW
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+extern struct in_addr ipc_accept_ip;
|
||||||
|
+extern int ipc_port;
|
||||||
|
+extern int nompr;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsrd_plugin_init(void);
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+olsr_plugin_exit(void);
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/txtinfo/version-script.txt olsrd-0.4.10/lib/txtinfo/version-script.txt
|
||||||
|
--- olsrd-0.4.10.orig/lib/txtinfo/version-script.txt 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/txtinfo/version-script.txt 2006-12-01 08:26:58.000000000 +0100
|
||||||
|
@@ -0,0 +1,10 @@
|
||||||
|
+VERS_1.0
|
||||||
|
+{
|
||||||
|
+ global:
|
||||||
|
+ olsrd_plugin_interface_version;
|
||||||
|
+ olsrd_plugin_register_param;
|
||||||
|
+ olsrd_plugin_init;
|
||||||
|
+
|
||||||
|
+ local:
|
||||||
|
+ *;
|
||||||
|
+};
|
@ -1,11 +0,0 @@
|
|||||||
diff -ur olsrd.old/src/cfgparser/oparse.c olsrd.dev/src/cfgparser/oparse.c
|
|
||||||
--- olsrd.old/src/cfgparser/oparse.c 2006-01-01 17:15:57.000000000 +0100
|
|
||||||
+++ olsrd.dev/src/cfgparser/oparse.c 2006-10-09 01:06:27.000000000 +0200
|
|
||||||
@@ -1921,6 +1921,7 @@
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
h->netmask.v4 = in.s_addr;
|
|
||||||
+ h->net.v4 &= h->netmask.v4;
|
|
||||||
/* Queue */
|
|
||||||
h->next = cnf->hna4_entries;
|
|
||||||
cnf->hna4_entries = h;
|
|
3231
net/olsrd/patches/150-olsrd-quagga.patch
Normal file
3231
net/olsrd/patches/150-olsrd-quagga.patch
Normal file
File diff suppressed because it is too large
Load Diff
259
net/olsrd/patches/160-olsrd-quagga-routehandler.patch
Normal file
259
net/olsrd/patches/160-olsrd-quagga-routehandler.patch
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/src/main.c olsrd-0.4.10/src/main.c
|
||||||
|
--- olsrd-0.4.10.orig/src/main.c 2005-09-29 07:53:34.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/main.c 2006-12-01 09:10:15.000000000 +0100
|
||||||
|
@@ -280,6 +280,9 @@
|
||||||
|
/* Initialize parser */
|
||||||
|
olsr_init_parser();
|
||||||
|
|
||||||
|
+ /* Initialize route-exporter */
|
||||||
|
+ olsr_init_export_route();
|
||||||
|
+
|
||||||
|
/* Initialize message sequencnumber */
|
||||||
|
init_msg_seqno();
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/process_routes.c olsrd-0.4.10/src/process_routes.c
|
||||||
|
--- olsrd-0.4.10.orig/src/process_routes.c 2005-05-30 15:13:38.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/process_routes.c 2006-12-01 09:10:15.000000000 +0100
|
||||||
|
@@ -3,6 +3,9 @@
|
||||||
|
* Copyright (c) 2004, Andreas Tønnesen(andreto@olsr.org)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
+ * export_route_entry interface added by Immo 'FaUl Wehrenberg
|
||||||
|
+ * <immo@chaostreff-dortmund.de>
|
||||||
|
+ *
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
@@ -39,7 +42,6 @@
|
||||||
|
* $Id: process_routes.c,v 1.27 2005/05/30 13:13:38 kattemat Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
-
|
||||||
|
#include "defs.h"
|
||||||
|
#include "olsr.h"
|
||||||
|
#include "log.h"
|
||||||
|
@@ -51,10 +53,162 @@
|
||||||
|
#define strerror(x) StrError(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+struct export_route_entry
|
||||||
|
+{
|
||||||
|
+ olsr_u8_t type; /* AF_INET/AF_INET6 */
|
||||||
|
+ int (*function)(struct rt_entry*);
|
||||||
|
+ struct export_route_entry *next;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static struct export_route_entry *add_routes;
|
||||||
|
+static struct export_route_entry *del_routes;
|
||||||
|
+
|
||||||
|
|
||||||
|
struct rt_entry old_routes[HASHSIZE];
|
||||||
|
struct rt_entry old_hna[HASHSIZE];
|
||||||
|
|
||||||
|
+void
|
||||||
|
+olsr_addroute_add_function(int (*function)(struct rt_entry*), olsr_u8_t type)
|
||||||
|
+{
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ tmp = olsr_malloc(sizeof *tmp, "olsr_addroute_add_function");
|
||||||
|
+ tmp->type = type;
|
||||||
|
+ tmp->function = function;
|
||||||
|
+ tmp->next = add_routes;
|
||||||
|
+ add_routes = tmp;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+olsr_delroute_add_function(int (*function) (struct rt_entry*), olsr_u8_t type)
|
||||||
|
+{
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ tmp = olsr_malloc(sizeof *tmp, "olsr_delroute_add_function");
|
||||||
|
+ tmp->type = type;
|
||||||
|
+ tmp->function = function;
|
||||||
|
+ tmp->next = del_routes;
|
||||||
|
+ del_routes = tmp;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_addroute_remove_function(int (*function) (struct rt_entry*), olsr_u8_t type)
|
||||||
|
+{
|
||||||
|
+ struct export_route_entry *tmp, *prev = NULL /* Make compiler happy */;
|
||||||
|
+ tmp = add_routes;
|
||||||
|
+ while (tmp)
|
||||||
|
+ {
|
||||||
|
+ if (function == tmp->function && type == tmp->type)
|
||||||
|
+ {
|
||||||
|
+ if (tmp == add_routes)
|
||||||
|
+ {
|
||||||
|
+ add_routes = add_routes->next;
|
||||||
|
+ free (tmp);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ prev->next = tmp->next;
|
||||||
|
+ free (tmp);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ prev = tmp;
|
||||||
|
+ tmp = tmp->next;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_delroute_remove_function(int (*function) (struct rt_entry*), olsr_u8_t type)
|
||||||
|
+{
|
||||||
|
+ struct export_route_entry *tmp, *prev = NULL /* Make compiler happy */;
|
||||||
|
+ tmp = del_routes;
|
||||||
|
+ while (tmp)
|
||||||
|
+ {
|
||||||
|
+ if (function == tmp->function && type == tmp->type)
|
||||||
|
+ {
|
||||||
|
+ if (tmp == del_routes)
|
||||||
|
+ {
|
||||||
|
+ del_routes = del_routes->next;
|
||||||
|
+ free (tmp);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ prev->next = tmp->next;
|
||||||
|
+ free (tmp);
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ prev = tmp;
|
||||||
|
+ tmp = tmp->next;
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+olsr_init_export_route()
|
||||||
|
+{
|
||||||
|
+ olsr_addroute_add_function(&olsr_ioctl_add_route, AF_INET);
|
||||||
|
+ olsr_addroute_add_function(&olsr_ioctl_add_route6, AF_INET6);
|
||||||
|
+ olsr_delroute_add_function(&olsr_ioctl_del_route, AF_INET);
|
||||||
|
+ olsr_delroute_add_function(&olsr_ioctl_del_route6, AF_INET6);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_add_route (struct rt_entry *e)
|
||||||
|
+{
|
||||||
|
+ int retval = 0;
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ for (tmp = add_routes; tmp; tmp = tmp->next)
|
||||||
|
+ {
|
||||||
|
+ if (tmp->type == AF_INET)
|
||||||
|
+ retval = tmp->function(e);
|
||||||
|
+ }
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_add_route6 (struct rt_entry *e)
|
||||||
|
+{
|
||||||
|
+ int retval = 0;
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ for (tmp = add_routes; tmp; tmp = tmp->next)
|
||||||
|
+ {
|
||||||
|
+ if (tmp->type == AF_INET6)
|
||||||
|
+ retval = tmp->function(e);
|
||||||
|
+ }
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_del_route (struct rt_entry *e)
|
||||||
|
+{
|
||||||
|
+ int retval = 0;
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ for (tmp = del_routes; tmp; tmp = tmp->next)
|
||||||
|
+ {
|
||||||
|
+ if (tmp->type == AF_INET)
|
||||||
|
+ retval = tmp->function(e);
|
||||||
|
+ }
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_del_route6 (struct rt_entry *e)
|
||||||
|
+{
|
||||||
|
+ int retval = 0;
|
||||||
|
+ struct export_route_entry *tmp;
|
||||||
|
+ for (tmp = del_routes; tmp; tmp = tmp->next)
|
||||||
|
+ {
|
||||||
|
+ if (tmp->type == AF_INET6)
|
||||||
|
+ retval = tmp->function(e);
|
||||||
|
+ }
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
|
||||||
|
int
|
||||||
|
olsr_init_old_table()
|
||||||
|
@@ -348,9 +502,9 @@
|
||||||
|
if(!olsr_cnf->host_emul)
|
||||||
|
{
|
||||||
|
if(olsr_cnf->ip_version == AF_INET)
|
||||||
|
- error = olsr_ioctl_del_route(destination_ptr->destination);
|
||||||
|
+ error = olsr_export_del_route(destination_ptr->destination);
|
||||||
|
else
|
||||||
|
- error = olsr_ioctl_del_route6(destination_ptr->destination);
|
||||||
|
+ error = olsr_export_del_route6(destination_ptr->destination);
|
||||||
|
|
||||||
|
if(error < 0)
|
||||||
|
{
|
||||||
|
@@ -436,9 +590,9 @@
|
||||||
|
if(!olsr_cnf->host_emul)
|
||||||
|
{
|
||||||
|
if(olsr_cnf->ip_version == AF_INET)
|
||||||
|
- error=olsr_ioctl_add_route(destination_kernel->destination);
|
||||||
|
+ error=olsr_export_add_route(destination_kernel->destination);
|
||||||
|
else
|
||||||
|
- error=olsr_ioctl_add_route6(destination_kernel->destination);
|
||||||
|
+ error=olsr_export_add_route6(destination_kernel->destination);
|
||||||
|
|
||||||
|
if(error < 0)
|
||||||
|
{
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/process_routes.h olsrd-0.4.10/src/process_routes.h
|
||||||
|
--- olsrd-0.4.10.orig/src/process_routes.h 2005-05-29 14:47:45.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/process_routes.h 2006-12-01 09:10:15.000000000 +0100
|
||||||
|
@@ -50,6 +50,34 @@
|
||||||
|
extern struct rt_entry old_routes[HASHSIZE];
|
||||||
|
extern struct rt_entry old_hna[HASHSIZE];
|
||||||
|
|
||||||
|
+void
|
||||||
|
+olsr_init_export_route(void);
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+olsr_addroute_add_function(int (*)(struct rt_entry*), olsr_u8_t);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_addroute_remove_function(int (*)(struct rt_entry*), olsr_u8_t);
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+olsr_delroute_add_function(int (*)(struct rt_entry*), olsr_u8_t);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_delroute_remove_function(int (*)(struct rt_entry*), olsr_u8_t);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_add_route (struct rt_entry*);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_del_route (struct rt_entry*);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_add_route6 (struct rt_entry*);
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+olsr_export_del_route6 (struct rt_entry*);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
int
|
||||||
|
olsr_init_old_table(void);
|
||||||
|
|
3573
net/olsrd/patches/170-olsrd-bmf.patch
Normal file
3573
net/olsrd/patches/170-olsrd-bmf.patch
Normal file
File diff suppressed because it is too large
Load Diff
336
net/olsrd/patches/180-olsrd-bmf-fixes.patch
Normal file
336
net/olsrd/patches/180-olsrd-bmf-fixes.patch
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/bmf/src/Bmf.c olsrd-0.4.10/lib/bmf/src/Bmf.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/bmf/src/Bmf.c 2006-11-29 12:45:19.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/bmf/src/Bmf.c 2006-11-29 12:47:49.000000000 +0100
|
||||||
|
@@ -114,7 +114,15 @@
|
||||||
|
|
||||||
|
/* Only forward multicast or local broadcast packets */
|
||||||
|
COPY_IP(&destIp, &ipData->ip_dst);
|
||||||
|
- if (! IsMulticast(&destIp) && ! IsLocalBroadcast(&destIp, intf))
|
||||||
|
+ if (! IsMulticast(&destIp)
|
||||||
|
+#ifdef SVEN_OLA_DISABLED
|
||||||
|
+ /*
|
||||||
|
+ * Sven-Ola@gmx.de: In a bigger mesh, there are a lot of
|
||||||
|
+ * accidential bcast sources. Disabled to save bandwidth
|
||||||
|
+ */
|
||||||
|
+ && ! IsLocalBroadcast(&destIp, intf)
|
||||||
|
+#endif
|
||||||
|
+ )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -128,9 +136,10 @@
|
||||||
|
COPY_IP(&srcIp, &ipData->ip_src);
|
||||||
|
olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: pkt of %d bytes incoming on \"%s\": %s->%s\n",
|
||||||
|
+ "%s: pkt of %d bytes ttl=%d incoming on \"%s\": %s->%s\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
ethPktLen,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
intf->ifName,
|
||||||
|
olsr_ip_to_string(&srcIp),
|
||||||
|
olsr_ip_to_string(&destIp));
|
||||||
|
@@ -191,6 +200,7 @@
|
||||||
|
struct TEncapHeader* encapHdr = (struct TEncapHeader*) buffer;
|
||||||
|
memset (encapHdr, 0, ENCAP_HDR_LEN);
|
||||||
|
encapHdr->crc32 = htonl(crc32);
|
||||||
|
+ encapHdr->encapttl = GetIpTtl(ethPkt);
|
||||||
|
|
||||||
|
/* If this packet is captured on an OLSR interface from an OLSR neighbor,
|
||||||
|
* check with OLSR if I am MPR for that neighbor */
|
||||||
|
@@ -248,7 +258,7 @@
|
||||||
|
/* If the TTL is <= 0, do not forward this packet */
|
||||||
|
if (GetIpTtl(ethPkt) <= 0)
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> not forwarding on \"%s\": TTL=0\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -272,10 +282,11 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: --> forwarded to \"%s\"\n",
|
||||||
|
+ "%s: --> forwarded(capt) ttl=%d to \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
fwIntf->ifName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -291,6 +302,7 @@
|
||||||
|
if (isToOlsrIntf && !iAmNotMpr)
|
||||||
|
{
|
||||||
|
int nBytesWritten;
|
||||||
|
+ unsigned char ttl;
|
||||||
|
|
||||||
|
/* Change encapsulated source MAC address to that of sending interface */
|
||||||
|
memcpy(ethPkt + IFHWADDRLEN, fwIntf->macAddr, IFHWADDRLEN);
|
||||||
|
@@ -298,6 +310,10 @@
|
||||||
|
/* Destination address is local broadcast */
|
||||||
|
encapDest.sin_addr.s_addr = ((struct sockaddr_in*)&fwIntf->olsrIntf->int_broadaddr)->sin_addr.s_addr;
|
||||||
|
|
||||||
|
+ /* SVEN_OLA: Normal TTL of this socket will be 64 if unset */
|
||||||
|
+ ttl = GetIpTtl(ethPkt);
|
||||||
|
+ if (0 <= (nBytesWritten = setsockopt(fwIntf->encapsulatingSkfd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl))))
|
||||||
|
+
|
||||||
|
nBytesWritten = sendto(
|
||||||
|
fwIntf->encapsulatingSkfd,
|
||||||
|
buffer,
|
||||||
|
@@ -306,6 +322,18 @@
|
||||||
|
(struct sockaddr*) &encapDest,
|
||||||
|
sizeof(encapDest));
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * Sven-Ola@gmx.de: Very primitive testing of forward error correction
|
||||||
|
+ */
|
||||||
|
+ if (nBytesWritten == len)
|
||||||
|
+ nBytesWritten = sendto(
|
||||||
|
+ fwIntf->encapsulatingSkfd,
|
||||||
|
+ buffer,
|
||||||
|
+ len,
|
||||||
|
+ MSG_DONTROUTE,
|
||||||
|
+ (struct sockaddr*) &encapDest,
|
||||||
|
+ sizeof(encapDest));
|
||||||
|
+
|
||||||
|
if (nBytesWritten != len)
|
||||||
|
{
|
||||||
|
olsr_printf(
|
||||||
|
@@ -318,10 +346,11 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: --> encapsulated and forwarded to \"%s\"\n",
|
||||||
|
+ "%s: --> encapsulated and forwarded ttl=%d to \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
fwIntf->ifName);
|
||||||
|
} /* if (nBytesWritten != len) */
|
||||||
|
} /* else if (isToOlsrIntf && !iAmNotMpr) */
|
||||||
|
@@ -329,7 +358,7 @@
|
||||||
|
else /* (!isFromOlsrIntf || isToOlsrIntf) && (!isToOlsrIntf || iAmNotMpr) */
|
||||||
|
if (!isFromOlsrIntf && !isToOlsrIntf)
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> not forwarding from \"%s\" to \"%s\": both non-OLSR interfaces\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -339,7 +368,7 @@
|
||||||
|
|
||||||
|
else /* (!isFromOlsrIntf || isToOlsrIntf) && (!isToOlsrIntf || iAmNotMpr) && (isFromOlsrIntf || isToOlsrIntf) */
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> not forwarding from \"%s\" to \"%s\": I am not selected as MPR by %s\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -402,17 +431,21 @@
|
||||||
|
|
||||||
|
ipData = (struct ip*) (ethPkt + IP_HDR_OFFSET);
|
||||||
|
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: encapsulated pkt of %d bytes incoming on \"%s\": %s->",
|
||||||
|
+ "%s: encapsulated pkt of %d bytes ttl=%d incoming on \"%s\": %s->",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
ethPktLen,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
intf->ifName,
|
||||||
|
inet_ntoa(ipData->ip_src));
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s, forwarded by %s\n",
|
||||||
|
- inet_ntoa(ipData->ip_dst), /* not possible to call inet_ntoa twice in same printf */
|
||||||
|
+ "%s, ",
|
||||||
|
+ inet_ntoa(ipData->ip_dst)); /* not possible to call inet_ntoa twice in same printf */
|
||||||
|
+ olsr_printf(
|
||||||
|
+ 9,
|
||||||
|
+ "forwarded by %s\n",
|
||||||
|
olsr_ip_to_string(fromIp));
|
||||||
|
|
||||||
|
/* Get encapsulation header */
|
||||||
|
@@ -421,7 +454,7 @@
|
||||||
|
/* Check if this packet was seen recently */
|
||||||
|
if (CheckAndMarkRecentPacket(Hash16(ntohl(encapHdr->crc32))))
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> discarding: packet is duplicate\n",
|
||||||
|
PLUGIN_NAME_SHORT);
|
||||||
|
@@ -448,12 +481,28 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: --> unpacked and forwarded to \"%s\"\n",
|
||||||
|
+ "%s: --> unpacked and forwarded ttl=%d to \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
EtherTunTapIfName);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Sven-Ola@gmx.de: The original implemenation make a wave
|
||||||
|
+ * through the complete mesh for every packet. Packets are
|
||||||
|
+ * discarded if any device has seen it (most bad case). We
|
||||||
|
+ * Want some "local" distribution mode, so I've added some
|
||||||
|
+ * hopcounter here - derived from the original ttl
|
||||||
|
+ */
|
||||||
|
+ if (0 == encapHdr->encapttl || 0 == --encapHdr->encapttl) {
|
||||||
|
+ olsr_printf(
|
||||||
|
+ 9,
|
||||||
|
+ "%s: --> dicarding encapsulated: TTL=0\n",
|
||||||
|
+ PLUGIN_NAME_SHORT);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* Lookup main address of forwarding node */
|
||||||
|
forwarder = mid_lookup_main_addr(fromIp);
|
||||||
|
@@ -489,7 +538,7 @@
|
||||||
|
/* If the TTL is <= 0, do not forward this packet */
|
||||||
|
if (GetIpTtl(ethPkt) <= 0)
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> not forwarding on \"%s\": TTL=0\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -509,10 +558,12 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: --> unpacked and forwarded to \"%s\"\n",
|
||||||
|
+ "%s: --> unpacked and forwarded ttl=%d, sttl=%d to \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
+ sttl.ttl,
|
||||||
|
fwIntf->ifName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -551,17 +602,18 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
- "%s: --> forwarded to \"%s\"\n",
|
||||||
|
+ "%s: --> forwarded(encrec) ttl=%d to \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
+ GetIpTtl(ethPkt),
|
||||||
|
fwIntf->ifName);
|
||||||
|
}
|
||||||
|
} /* else if (iAmMpr) */
|
||||||
|
else /* fwIntf->olsrIntf != NULL && !iAmMpr */
|
||||||
|
{
|
||||||
|
/* fwIntf is an OLSR interface and I am not selected as MPR */
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: --> not forwarding to \"%s\": I am not selected as MPR by %s\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -690,7 +742,15 @@
|
||||||
|
{
|
||||||
|
union olsr_ip_addr destIp;
|
||||||
|
COPY_IP(&destIp, &ipData->ip_dst);
|
||||||
|
- if (IsMulticast(&destIp) || IsLocalBroadcast(&destIp, currIf))
|
||||||
|
+ if (IsMulticast(&destIp)
|
||||||
|
+#ifdef SVEN_OLA_DISABLED
|
||||||
|
+ /*
|
||||||
|
+ * Sven-Ola@gmx.de: In a bigger mesh, there are a lot of
|
||||||
|
+ * accidential bcast sources. Disabled to save bandwidth
|
||||||
|
+ */
|
||||||
|
+ || IsLocalBroadcast(&destIp, currIf)
|
||||||
|
+#endif
|
||||||
|
+ )
|
||||||
|
{
|
||||||
|
if (! IsOlsrOrBmfPacket(currIf, ethPkt, nBytes))
|
||||||
|
{
|
||||||
|
@@ -701,8 +761,15 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- else if (pktAddr.sll_pkttype == PACKET_MULTICAST ||
|
||||||
|
- pktAddr.sll_pkttype == PACKET_BROADCAST)
|
||||||
|
+ else if (pktAddr.sll_pkttype == PACKET_MULTICAST
|
||||||
|
+#ifdef SVEN_OLA_DISABLED
|
||||||
|
+ /*
|
||||||
|
+ * Sven-Ola@gmx.de: In a bigger mesh, there are a lot of
|
||||||
|
+ * accidential bcast sources. Disabled to save bandwidth
|
||||||
|
+ */
|
||||||
|
+ || pktAddr.sll_pkttype == PACKET_BROADCAST
|
||||||
|
+#endif
|
||||||
|
+ )
|
||||||
|
{
|
||||||
|
/* An inbound multicast or broadcast packet was captured */
|
||||||
|
BmfPacketCaptured(currIf, buffer, nBytes + ENCAP_HDR_LEN);
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/bmf/src/NetworkInterfaces.c olsrd-0.4.10/lib/bmf/src/NetworkInterfaces.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/bmf/src/NetworkInterfaces.c 2006-11-29 12:45:19.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/bmf/src/NetworkInterfaces.c 2006-11-29 12:47:49.000000000 +0100
|
||||||
|
@@ -568,7 +568,7 @@
|
||||||
|
newIf->next = BmfInterfaces;
|
||||||
|
BmfInterfaces = newIf;
|
||||||
|
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: opened %s interface \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -738,7 +738,7 @@
|
||||||
|
nClosed++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- OLSR_PRINTF(
|
||||||
|
+ olsr_printf(
|
||||||
|
9,
|
||||||
|
"%s: closed %s interface \"%s\"\n",
|
||||||
|
PLUGIN_NAME_SHORT,
|
||||||
|
@@ -756,7 +756,7 @@
|
||||||
|
close(EtherTunTapFd);
|
||||||
|
nClosed++;
|
||||||
|
|
||||||
|
- OLSR_PRINTF(9, "%s: closed \"%s\"\n", PLUGIN_NAME_SHORT, EtherTunTapIfName);
|
||||||
|
+ olsr_printf(9, "%s: closed \"%s\"\n", PLUGIN_NAME_SHORT, EtherTunTapIfName);
|
||||||
|
}
|
||||||
|
|
||||||
|
BmfInterfaces = NULL;
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/bmf/src/Packet.c olsrd-0.4.10/lib/bmf/src/Packet.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/bmf/src/Packet.c 2006-11-29 12:45:19.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/bmf/src/Packet.c 2006-11-29 12:50:35.000000000 +0100
|
||||||
|
@@ -46,6 +46,8 @@
|
||||||
|
#include <assert.h> /* assert() */
|
||||||
|
#include <sys/types.h> /* u_int32_t */
|
||||||
|
#include <netinet/in.h> /* ntohs(), htons() */
|
||||||
|
+/* Fixes (k)ubuntu linux-kernel-headers package */
|
||||||
|
+#include <asm/byteorder.h>
|
||||||
|
#include <linux/ip.h>
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/bmf/src/Packet.h olsrd-0.4.10/lib/bmf/src/Packet.h
|
||||||
|
--- olsrd-0.4.10.orig/lib/bmf/src/Packet.h 2006-11-29 12:45:19.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/bmf/src/Packet.h 2006-11-29 12:47:49.000000000 +0100
|
||||||
|
@@ -66,7 +66,8 @@
|
||||||
|
u_int32_t crc32;
|
||||||
|
u_int32_t futureExpansion1;
|
||||||
|
u_int32_t futureExpansion2;
|
||||||
|
- u_int32_t futureExpansion3;
|
||||||
|
+ u_int8_t futureExpansion3[3];
|
||||||
|
+ u_int8_t encapttl;
|
||||||
|
} __attribute__((__packed__));
|
||||||
|
|
||||||
|
#define ENCAP_HDR_LEN sizeof(struct TEncapHeader)
|
1284
net/olsrd/patches/200-olsrd-fixes-eric.patch
Normal file
1284
net/olsrd/patches/200-olsrd-fixes-eric.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
diff -Nur olsrd-0.4.10.orig/src/defs.h olsrd-0.4.10/src/defs.h
|
diff -Nur olsrd-0.4.10.orig/src/defs.h olsrd-0.4.10/src/defs.h
|
||||||
--- olsrd-0.4.10.orig/src/defs.h 2006-01-01 16:59:02.000000000 +0100
|
--- olsrd-0.4.10.orig/src/defs.h 2006-11-28 21:17:27.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/defs.h 2006-10-31 19:34:52.000000000 +0100
|
+++ olsrd-0.4.10/src/defs.h 2006-11-28 21:18:46.000000000 +0100
|
||||||
@@ -68,10 +68,10 @@
|
@@ -68,10 +68,10 @@
|
||||||
#define OLSRD_GLOBAL_CONF_FILE "/etc/" OLSRD_CONF_FILE_NAME
|
#define OLSRD_GLOBAL_CONF_FILE "/etc/" OLSRD_CONF_FILE_NAME
|
||||||
#endif
|
#endif
|
||||||
@ -11,12 +11,12 @@ diff -Nur olsrd-0.4.10.orig/src/defs.h olsrd-0.4.10/src/defs.h
|
|||||||
#define UDP_IPV4_HDRSIZE 28
|
#define UDP_IPV4_HDRSIZE 28
|
||||||
-#define UDP_IPV6_HDRSIZE 48
|
-#define UDP_IPV6_HDRSIZE 48
|
||||||
+#define UDP_IPV6_HDRSIZE 62
|
+#define UDP_IPV6_HDRSIZE 62
|
||||||
#define MAX_IFS 16
|
#define MAX_IFS 32
|
||||||
|
|
||||||
/* Debug helper macro */
|
/* Debug helper macro */
|
||||||
diff -Nur olsrd-0.4.10.orig/src/interfaces.h olsrd-0.4.10/src/interfaces.h
|
diff -Nur olsrd-0.4.10.orig/src/interfaces.h olsrd-0.4.10/src/interfaces.h
|
||||||
--- olsrd-0.4.10.orig/src/interfaces.h 2005-06-03 10:00:55.000000000 +0200
|
--- olsrd-0.4.10.orig/src/interfaces.h 2005-06-03 10:00:55.000000000 +0200
|
||||||
+++ olsrd-0.4.10/src/interfaces.h 2006-10-31 19:44:52.000000000 +0100
|
+++ olsrd-0.4.10/src/interfaces.h 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -136,6 +136,8 @@
|
@@ -136,6 +136,8 @@
|
||||||
struct vtimes valtimes;
|
struct vtimes valtimes;
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ diff -Nur olsrd-0.4.10.orig/src/interfaces.h olsrd-0.4.10/src/interfaces.h
|
|||||||
struct interface *int_next;
|
struct interface *int_next;
|
||||||
};
|
};
|
||||||
diff -Nur olsrd-0.4.10.orig/src/link_set.c olsrd-0.4.10/src/link_set.c
|
diff -Nur olsrd-0.4.10.orig/src/link_set.c olsrd-0.4.10/src/link_set.c
|
||||||
--- olsrd-0.4.10.orig/src/link_set.c 2005-11-17 05:25:44.000000000 +0100
|
--- olsrd-0.4.10.orig/src/link_set.c 2006-11-28 21:17:27.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/link_set.c 2006-10-31 19:31:19.000000000 +0100
|
+++ olsrd-0.4.10/src/link_set.c 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -952,8 +952,9 @@
|
@@ -963,8 +963,9 @@
|
||||||
|
|
||||||
entry->loss_link_quality =
|
entry->loss_link_quality =
|
||||||
(float)(entry->total_packets - entry->lost_packets) /
|
(float)(entry->total_packets - entry->lost_packets) /
|
||||||
@ -43,7 +43,7 @@ diff -Nur olsrd-0.4.10.orig/src/link_set.c olsrd-0.4.10/src/link_set.c
|
|||||||
entry->loss_link_quality *= entry->loss_link_multiplier;
|
entry->loss_link_quality *= entry->loss_link_multiplier;
|
||||||
diff -Nur olsrd-0.4.10.orig/src/lq_packet.c olsrd-0.4.10/src/lq_packet.c
|
diff -Nur olsrd-0.4.10.orig/src/lq_packet.c olsrd-0.4.10/src/lq_packet.c
|
||||||
--- olsrd-0.4.10.orig/src/lq_packet.c 2005-11-17 02:58:51.000000000 +0100
|
--- olsrd-0.4.10.orig/src/lq_packet.c 2005-11-17 02:58:51.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/lq_packet.c 2006-10-31 21:51:11.000000000 +0100
|
+++ olsrd-0.4.10/src/lq_packet.c 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -149,9 +149,8 @@
|
@@ -149,9 +149,8 @@
|
||||||
int i;
|
int i;
|
||||||
struct neighbor_entry *walker;
|
struct neighbor_entry *walker;
|
||||||
@ -74,8 +74,8 @@ diff -Nur olsrd-0.4.10.orig/src/lq_packet.c olsrd-0.4.10/src/lq_packet.c
|
|||||||
OLSR_PRINTF(3, "Creating LQ TC with TTL %d.\n", lq_tc->comm.ttl);
|
OLSR_PRINTF(3, "Creating LQ TC with TTL %d.\n", lq_tc->comm.ttl);
|
||||||
}
|
}
|
||||||
diff -Nur olsrd-0.4.10.orig/src/olsr.c olsrd-0.4.10/src/olsr.c
|
diff -Nur olsrd-0.4.10.orig/src/olsr.c olsrd-0.4.10/src/olsr.c
|
||||||
--- olsrd-0.4.10.orig/src/olsr.c 2005-11-17 05:25:44.000000000 +0100
|
--- olsrd-0.4.10.orig/src/olsr.c 2006-11-28 21:17:27.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/olsr.c 2006-10-31 19:31:19.000000000 +0100
|
+++ olsrd-0.4.10/src/olsr.c 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -68,6 +68,7 @@
|
@@ -68,6 +68,7 @@
|
||||||
olsr_bool changes_topology;
|
olsr_bool changes_topology;
|
||||||
olsr_bool changes_neighborhood;
|
olsr_bool changes_neighborhood;
|
||||||
@ -137,7 +137,7 @@ diff -Nur olsrd-0.4.10.orig/src/olsr.c olsrd-0.4.10/src/olsr.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (olsr_cnf->debug_level > 0)
|
if (olsr_cnf->debug_level > 0)
|
||||||
@@ -239,6 +235,7 @@
|
@@ -243,6 +239,7 @@
|
||||||
changes_neighborhood = OLSR_FALSE;
|
changes_neighborhood = OLSR_FALSE;
|
||||||
changes_topology = OLSR_FALSE;
|
changes_topology = OLSR_FALSE;
|
||||||
changes_hna = OLSR_FALSE;
|
changes_hna = OLSR_FALSE;
|
||||||
@ -147,7 +147,7 @@ diff -Nur olsrd-0.4.10.orig/src/olsr.c olsrd-0.4.10/src/olsr.c
|
|||||||
return;
|
return;
|
||||||
diff -Nur olsrd-0.4.10.orig/src/olsr.h olsrd-0.4.10/src/olsr.h
|
diff -Nur olsrd-0.4.10.orig/src/olsr.h olsrd-0.4.10/src/olsr.h
|
||||||
--- olsrd-0.4.10.orig/src/olsr.h 2005-05-29 14:47:45.000000000 +0200
|
--- olsrd-0.4.10.orig/src/olsr.h 2005-05-29 14:47:45.000000000 +0200
|
||||||
+++ olsrd-0.4.10/src/olsr.h 2006-10-31 19:31:19.000000000 +0100
|
+++ olsrd-0.4.10/src/olsr.h 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -49,6 +49,7 @@
|
@@ -49,6 +49,7 @@
|
||||||
extern olsr_bool changes_topology;
|
extern olsr_bool changes_topology;
|
||||||
extern olsr_bool changes_neighborhood;
|
extern olsr_bool changes_neighborhood;
|
||||||
@ -158,7 +158,7 @@ diff -Nur olsrd-0.4.10.orig/src/olsr.h olsrd-0.4.10/src/olsr.h
|
|||||||
register_pcf(int (*)(int, int, int));
|
register_pcf(int (*)(int, int, int));
|
||||||
diff -Nur olsrd-0.4.10.orig/src/scheduler.c olsrd-0.4.10/src/scheduler.c
|
diff -Nur olsrd-0.4.10.orig/src/scheduler.c olsrd-0.4.10/src/scheduler.c
|
||||||
--- olsrd-0.4.10.orig/src/scheduler.c 2005-12-29 23:34:37.000000000 +0100
|
--- olsrd-0.4.10.orig/src/scheduler.c 2005-12-29 23:34:37.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/scheduler.c 2006-10-31 19:31:19.000000000 +0100
|
+++ olsrd-0.4.10/src/scheduler.c 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -70,6 +70,7 @@
|
@@ -70,6 +70,7 @@
|
||||||
|
|
||||||
changes_neighborhood = OLSR_TRUE;
|
changes_neighborhood = OLSR_TRUE;
|
||||||
@ -168,9 +168,9 @@ diff -Nur olsrd-0.4.10.orig/src/scheduler.c olsrd-0.4.10/src/scheduler.c
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
diff -Nur olsrd-0.4.10.orig/src/unix/ifnet.c olsrd-0.4.10/src/unix/ifnet.c
|
diff -Nur olsrd-0.4.10.orig/src/unix/ifnet.c olsrd-0.4.10/src/unix/ifnet.c
|
||||||
--- olsrd-0.4.10.orig/src/unix/ifnet.c 2005-12-29 19:37:16.000000000 +0100
|
--- olsrd-0.4.10.orig/src/unix/ifnet.c 2006-11-28 21:17:27.000000000 +0100
|
||||||
+++ olsrd-0.4.10/src/unix/ifnet.c 2006-10-31 21:44:59.000000000 +0100
|
+++ olsrd-0.4.10/src/unix/ifnet.c 2006-11-28 21:18:01.000000000 +0100
|
||||||
@@ -689,6 +689,17 @@
|
@@ -690,6 +690,17 @@
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ diff -Nur olsrd-0.4.10.orig/src/unix/ifnet.c olsrd-0.4.10/src/unix/ifnet.c
|
|||||||
/**
|
/**
|
||||||
* Initializes a interface described by iface,
|
* Initializes a interface described by iface,
|
||||||
* if it is set up and is of the correct type.
|
* if it is set up and is of the correct type.
|
||||||
@@ -832,10 +843,10 @@
|
@@ -833,10 +844,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deactivate IP spoof filter */
|
/* Deactivate IP spoof filter */
|
||||||
@ -201,7 +201,7 @@ diff -Nur olsrd-0.4.10.orig/src/unix/ifnet.c olsrd-0.4.10/src/unix/ifnet.c
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,7 +907,7 @@
|
@@ -894,7 +905,7 @@
|
||||||
ifp->gen_properties = NULL;
|
ifp->gen_properties = NULL;
|
||||||
ifp->int_name = olsr_malloc(strlen(ifr.ifr_name) + 1, "Interface update 3");
|
ifp->int_name = olsr_malloc(strlen(ifr.ifr_name) + 1, "Interface update 3");
|
||||||
|
|
425
net/olsrd/patches/220-olsrd-fixes-jhay-bsd.patch
Normal file
425
net/olsrd/patches/220-olsrd-fixes-jhay-bsd.patch
Normal file
@ -0,0 +1,425 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/src/bsd/kernel_routes.c olsrd-0.4.10/src/bsd/kernel_routes.c
|
||||||
|
--- olsrd-0.4.10.orig/src/bsd/kernel_routes.c 2005-02-27 11:43:38.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/bsd/kernel_routes.c 2006-12-12 08:59:26.000000000 +0100
|
||||||
|
@@ -170,12 +170,103 @@
|
||||||
|
return add_del_route(dest, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
-int olsr_ioctl_add_route6(struct rt_entry *dest)
|
||||||
|
+static int add_del_route6(struct rt_entry *dest, int add)
|
||||||
|
{
|
||||||
|
+ struct rt_msghdr *rtm;
|
||||||
|
+ unsigned char buff[512];
|
||||||
|
+ unsigned char *walker;
|
||||||
|
+ struct sockaddr_in6 sin6;
|
||||||
|
+ struct sockaddr_dl sdl;
|
||||||
|
+ int step, step_dl;
|
||||||
|
+ int len;
|
||||||
|
+ char Str1[40], Str2[40];
|
||||||
|
+
|
||||||
|
+ inet_ntop(AF_INET6, &dest->rt_dst.v6, Str1, 40);
|
||||||
|
+ inet_ntop(AF_INET6, &dest->rt_router.v6, Str2, 40);
|
||||||
|
+
|
||||||
|
+ OLSR_PRINTF(1, "%s IPv6 route to %s/%d via %s.\n",
|
||||||
|
+ (add != 0) ? "Adding" : "Removing", Str1, dest->rt_mask.v6, Str2)
|
||||||
|
+
|
||||||
|
+ memset(buff, 0, sizeof (buff));
|
||||||
|
+ memset(&sin6, 0, sizeof (sin6));
|
||||||
|
+ memset(&sdl, 0, sizeof (sdl));
|
||||||
|
+
|
||||||
|
+ sin6.sin6_len = sizeof (sin6);
|
||||||
|
+ sin6.sin6_family = AF_INET6;
|
||||||
|
+ sdl.sdl_len = sizeof (sdl);
|
||||||
|
+ sdl.sdl_family = AF_LINK;
|
||||||
|
+
|
||||||
|
+ step = 1 + ((sizeof (struct sockaddr_in6) - 1) | 3);
|
||||||
|
+ step_dl = 1 + ((sizeof (struct sockaddr_dl) - 1) | 3);
|
||||||
|
+
|
||||||
|
+ rtm = (struct rt_msghdr *)buff;
|
||||||
|
+ rtm->rtm_version = RTM_VERSION;
|
||||||
|
+ rtm->rtm_type = (add != 0) ? RTM_ADD : RTM_DELETE;
|
||||||
|
+ rtm->rtm_index = 0;
|
||||||
|
+ rtm->rtm_flags = dest->rt_flags;
|
||||||
|
+ rtm->rtm_addrs = RTA_DST | RTA_GATEWAY;
|
||||||
|
+ rtm->rtm_seq = ++seq;
|
||||||
|
+
|
||||||
|
+ walker = buff + sizeof (struct rt_msghdr);
|
||||||
|
+
|
||||||
|
+ memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_dst.v6, sizeof(struct in6_addr));
|
||||||
|
+
|
||||||
|
+ memcpy(walker, &sin6, sizeof (sin6));
|
||||||
|
+ walker += step;
|
||||||
|
+
|
||||||
|
+ if ((rtm->rtm_flags & RTF_GATEWAY) != 0)
|
||||||
|
+ {
|
||||||
|
+ memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_router.v6, sizeof(struct in6_addr));
|
||||||
|
+
|
||||||
|
+ memcpy(walker, &sin6, sizeof (sin6));
|
||||||
|
+ walker += step;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // the host is directly reachable, so add the output interface's address
|
||||||
|
+
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ memcpy(&sin6.sin6_addr.s6_addr, &dest->rt_if->int6_addr.sin6_addr.s6_addr,
|
||||||
|
+ sizeof(struct in6_addr));
|
||||||
|
+
|
||||||
|
+ memcpy(walker, &sin6, sizeof (sin6));
|
||||||
|
+ walker += step;
|
||||||
|
+ rtm->rtm_flags |= RTF_LLINFO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((rtm->rtm_flags & RTF_HOST) == 0)
|
||||||
|
+ {
|
||||||
|
+ olsr_prefix_to_netmask((union olsr_ip_addr *)&sin6.sin6_addr, dest->rt_mask.v6);
|
||||||
|
+ memcpy(walker, &sin6, sizeof (sin6));
|
||||||
|
+ walker += step;
|
||||||
|
+ rtm->rtm_addrs |= RTA_NETMASK;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if ((rtm->rtm_flags & RTF_GATEWAY) != 0)
|
||||||
|
+ {
|
||||||
|
+ strcpy(&sdl.sdl_data[0], dest->rt_if->int_name);
|
||||||
|
+ sdl.sdl_nlen = (u_char)strlen(dest->rt_if->int_name);
|
||||||
|
+ memcpy(walker, &sdl, sizeof (sdl));
|
||||||
|
+ walker += step_dl;
|
||||||
|
+ rtm->rtm_addrs |= RTA_IFP;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ rtm->rtm_msglen = (unsigned short)(walker - buff);
|
||||||
|
+
|
||||||
|
+ len = write(rts, buff, rtm->rtm_msglen);
|
||||||
|
+
|
||||||
|
+ if (len < rtm->rtm_msglen)
|
||||||
|
+ fprintf(stderr, "cannot write to routing socket: %s\n", strerror(errno));
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int olsr_ioctl_add_route6(struct rt_entry *dest)
|
||||||
|
+{
|
||||||
|
+ return add_del_route6(dest, 1);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int olsr_ioctl_del_route6(struct rt_entry *dest)
|
||||||
|
{
|
||||||
|
- return 0;
|
||||||
|
+ return add_del_route6(dest, 0);
|
||||||
|
}
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/bsd/net.c olsrd-0.4.10/src/bsd/net.c
|
||||||
|
--- olsrd-0.4.10.orig/src/bsd/net.c 2005-08-28 21:30:29.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/bsd/net.c 2006-12-12 08:59:30.000000000 +0100
|
||||||
|
@@ -61,8 +61,10 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
+#include <ifaddrs.h>
|
||||||
|
#include <net/if_var.h>
|
||||||
|
#include <net/ethernet.h>
|
||||||
|
+#include <netinet/in_var.h>
|
||||||
|
#ifndef FBSD_NO_80211
|
||||||
|
#include <net80211/ieee80211.h>
|
||||||
|
#include <net80211/ieee80211_ioctl.h>
|
||||||
|
@@ -71,8 +73,8 @@
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#ifdef SPOOF
|
||||||
|
#include <net/if_dl.h>
|
||||||
|
+#ifdef SPOOF
|
||||||
|
#include <libnet.h>
|
||||||
|
#endif /* SPOOF */
|
||||||
|
|
||||||
|
@@ -172,6 +174,17 @@
|
||||||
|
name = "net.inet6.icmp6.rediraccept";
|
||||||
|
|
||||||
|
ignore_redir = set_sysctl_int(name, 0);
|
||||||
|
+#elif defined __FreeBSD__
|
||||||
|
+ if (olsr_cnf->ip_version == AF_INET)
|
||||||
|
+ {
|
||||||
|
+ name = "net.inet.icmp.drop_redirect";
|
||||||
|
+ ignore_redir = set_sysctl_int(name, 1);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ name = "net.inet6.icmp6.rediraccept";
|
||||||
|
+ ignore_redir = set_sysctl_int(name, 0);
|
||||||
|
+ }
|
||||||
|
#else
|
||||||
|
if (olsr_cnf->ip_version == AF_INET)
|
||||||
|
name = "net.inet.icmp.drop_redirect";
|
||||||
|
@@ -243,6 +256,12 @@
|
||||||
|
else
|
||||||
|
name = "net.inet6.icmp6.rediraccept";
|
||||||
|
|
||||||
|
+#elif defined __FreeBSD__
|
||||||
|
+ if (olsr_cnf->ip_version == AF_INET)
|
||||||
|
+ name = "net.inet.icmp.drop_redirect";
|
||||||
|
+
|
||||||
|
+ else
|
||||||
|
+ name = "net.inet6.icmp6.rediraccept";
|
||||||
|
#else
|
||||||
|
if (olsr_cnf->ip_version == AF_INET)
|
||||||
|
name = "net.inet.icmp.drop_redirect";
|
||||||
|
@@ -335,7 +354,6 @@
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
-#ifdef SPOOF
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEPORT failed");
|
||||||
|
@@ -347,7 +365,6 @@
|
||||||
|
perror("IP_RECVIF failed");
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
-#endif /* SPOOF */
|
||||||
|
|
||||||
|
for (on = bufspace; ; on -= 1024)
|
||||||
|
{
|
||||||
|
@@ -406,6 +423,18 @@
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
|
||||||
|
+ {
|
||||||
|
+ perror("SO_REUSEPORT failed");
|
||||||
|
+ return (-1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)) < 0)
|
||||||
|
+ {
|
||||||
|
+ perror("IPV6_RECVPKTINFO failed");
|
||||||
|
+ return (-1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (bind(sock, (struct sockaddr *)sin, sizeof (*sin)) < 0)
|
||||||
|
{
|
||||||
|
perror("bind");
|
||||||
|
@@ -425,31 +454,16 @@
|
||||||
|
int
|
||||||
|
join_mcast(struct interface *ifs, int sock)
|
||||||
|
{
|
||||||
|
- /* See linux/in6.h */
|
||||||
|
+ /* See netinet6/in6.h */
|
||||||
|
|
||||||
|
struct ipv6_mreq mcastreq;
|
||||||
|
|
||||||
|
COPY_IP(&mcastreq.ipv6mr_multiaddr, &ifs->int6_multaddr.sin6_addr);
|
||||||
|
mcastreq.ipv6mr_interface = ifs->if_index;
|
||||||
|
|
||||||
|
-#if 0
|
||||||
|
OLSR_PRINTF(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr))
|
||||||
|
- /* Send multicast */
|
||||||
|
- if(setsockopt(sock,
|
||||||
|
- IPPROTO_IPV6,
|
||||||
|
- IPV6_ADD_MEMBERSHIP,
|
||||||
|
- (char *)&mcastreq,
|
||||||
|
- sizeof(struct ipv6_mreq))
|
||||||
|
- < 0)
|
||||||
|
- {
|
||||||
|
- perror("Join multicast");
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-#else
|
||||||
|
-#warning implement IPV6_ADD_MEMBERSHIP
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
- /* Old libc fix */
|
||||||
|
+ /* rfc 3493 */
|
||||||
|
#ifdef IPV6_JOIN_GROUP
|
||||||
|
/* Join reciever group */
|
||||||
|
if(setsockopt(sock,
|
||||||
|
@@ -458,8 +472,8 @@
|
||||||
|
(char *)&mcastreq,
|
||||||
|
sizeof(struct ipv6_mreq))
|
||||||
|
< 0)
|
||||||
|
-#else
|
||||||
|
- /* Join reciever group */
|
||||||
|
+#else /* rfc 2133, obsoleted */
|
||||||
|
+ /* Join receiver group */
|
||||||
|
if(setsockopt(sock,
|
||||||
|
IPPROTO_IPV6,
|
||||||
|
IPV6_ADD_MEMBERSHIP,
|
||||||
|
@@ -494,6 +508,70 @@
|
||||||
|
|
||||||
|
int get_ipv6_address(char *ifname, struct sockaddr_in6 *saddr6, int scope_in)
|
||||||
|
{
|
||||||
|
+ struct ifaddrs *ifap, *ifa;
|
||||||
|
+ const struct sockaddr_in6 *sin6 = NULL;
|
||||||
|
+ struct in6_ifreq ifr6;
|
||||||
|
+ int found = 0;
|
||||||
|
+ int s6;
|
||||||
|
+ u_int32_t flags6;
|
||||||
|
+
|
||||||
|
+ if (getifaddrs(&ifap) != 0)
|
||||||
|
+ {
|
||||||
|
+ OLSR_PRINTF(3, "get_ipv6_address: getifaddrs() failed.\n")
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next)
|
||||||
|
+ {
|
||||||
|
+ if (ifa->ifa_addr->sa_family == AF_INET6 &&
|
||||||
|
+ strcmp(ifa->ifa_name, ifname) == 0)
|
||||||
|
+ {
|
||||||
|
+ sin6 = (const struct sockaddr_in6 *)ifa->ifa_addr;
|
||||||
|
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
|
||||||
|
+ continue;
|
||||||
|
+ strncpy(ifr6.ifr_name, ifname, sizeof(ifname));
|
||||||
|
+ if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
|
||||||
|
+ {
|
||||||
|
+ OLSR_PRINTF(3, "socket(AF_INET6,SOCK_DGRAM)");
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ ifr6.ifr_addr = *sin6;
|
||||||
|
+ if (ioctl(s6, SIOCGIFAFLAG_IN6, &ifr6) < 0)
|
||||||
|
+ {
|
||||||
|
+ OLSR_PRINTF(3, "ioctl(SIOCGIFAFLAG_IN6)");
|
||||||
|
+ close(s6);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ close(s6);
|
||||||
|
+ flags6 = ifr6.ifr_ifru.ifru_flags6;
|
||||||
|
+ if ((flags6 & IN6_IFF_ANYCAST) != 0)
|
||||||
|
+ continue;
|
||||||
|
+ if (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))
|
||||||
|
+ {
|
||||||
|
+ if (scope_in)
|
||||||
|
+ {
|
||||||
|
+ memcpy(&saddr6->sin6_addr, &sin6->sin6_addr,
|
||||||
|
+ sizeof(struct in6_addr));
|
||||||
|
+ found = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (scope_in == 0)
|
||||||
|
+ {
|
||||||
|
+ memcpy(&saddr6->sin6_addr, &sin6->sin6_addr,
|
||||||
|
+ sizeof(struct in6_addr));
|
||||||
|
+ found = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ freeifaddrs(ifap);
|
||||||
|
+ if (found)
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -621,16 +699,19 @@
|
||||||
|
struct sockaddr *from,
|
||||||
|
socklen_t *fromlen)
|
||||||
|
{
|
||||||
|
-#if SPOOF
|
||||||
|
struct msghdr mhdr;
|
||||||
|
struct iovec iov;
|
||||||
|
struct cmsghdr *cm;
|
||||||
|
struct sockaddr_dl *sdl;
|
||||||
|
struct sockaddr_in *sin = (struct sockaddr_in *) from; //XXX
|
||||||
|
+ struct sockaddr_in6 *sin6;
|
||||||
|
+ struct in6_addr *iaddr6;
|
||||||
|
+ struct in6_pktinfo *pkti;
|
||||||
|
+ struct interface *ifc;
|
||||||
|
+ char addrstr[INET6_ADDRSTRLEN];
|
||||||
|
+ char iname[IFNAMSIZ];
|
||||||
|
unsigned char chdr[4096];
|
||||||
|
int count;
|
||||||
|
- struct interface *ifc;
|
||||||
|
- char iname[32];
|
||||||
|
|
||||||
|
bzero(&mhdr, sizeof(mhdr));
|
||||||
|
bzero(&iov, sizeof(iov));
|
||||||
|
@@ -653,35 +734,45 @@
|
||||||
|
|
||||||
|
/* this needs to get communicated back to caller */
|
||||||
|
*fromlen = mhdr.msg_namelen;
|
||||||
|
-
|
||||||
|
- cm = (struct cmsghdr *) chdr;
|
||||||
|
- sdl = (struct sockaddr_dl *) CMSG_DATA (cm);
|
||||||
|
- bzero (iname, sizeof (iname));
|
||||||
|
- memcpy (iname, sdl->sdl_data, sdl->sdl_nlen);
|
||||||
|
+ if (olsr_cnf->ip_version == AF_INET6)
|
||||||
|
+ {
|
||||||
|
+ for (cm = (struct cmsghdr *)CMSG_FIRSTHDR(&mhdr); cm;
|
||||||
|
+ cm = (struct cmsghdr *)CMSG_NXTHDR(&mhdr, cm))
|
||||||
|
+ {
|
||||||
|
+ if (cm->cmsg_level == IPPROTO_IPV6 && cm->cmsg_type == IPV6_PKTINFO)
|
||||||
|
+ {
|
||||||
|
+ pkti = (struct in6_pktinfo *) CMSG_DATA(cm);
|
||||||
|
+ iaddr6 = &pkti->ipi6_addr;
|
||||||
|
+ if_indextoname(pkti->ipi6_ifindex, iname);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ cm = (struct cmsghdr *) chdr;
|
||||||
|
+ sdl = (struct sockaddr_dl *) CMSG_DATA (cm);
|
||||||
|
+ bzero (iname, sizeof (iname));
|
||||||
|
+ memcpy (iname, sdl->sdl_data, sdl->sdl_nlen);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
ifc = if_ifwithsock (s);
|
||||||
|
|
||||||
|
+ sin6 = (struct sockaddr_in6 *)from;
|
||||||
|
+ OLSR_PRINTF (4, "%d bytes from %s, socket associated %s really received on %s\n",
|
||||||
|
+ count,
|
||||||
|
+ (olsr_cnf->ip_version == AF_INET6) ?
|
||||||
|
+ inet_ntop(AF_INET6, (char *)&sin6->sin6_addr, addrstr,
|
||||||
|
+ INET6_ADDRSTRLEN):
|
||||||
|
+ inet_ntoa (sin->sin_addr),
|
||||||
|
+ ifc->int_name,
|
||||||
|
+ iname);
|
||||||
|
+
|
||||||
|
if (strcmp (ifc->int_name, iname) != 0)
|
||||||
|
{
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
- OLSR_PRINTF (2, "%d bytes from %s, socket associated %s really received on %s\n",
|
||||||
|
- count,
|
||||||
|
- inet_ntoa (sin->sin_addr),
|
||||||
|
- ifc->int_name,
|
||||||
|
- iname);
|
||||||
|
-
|
||||||
|
return (count);
|
||||||
|
-
|
||||||
|
-#else /* SPOOF */
|
||||||
|
- return recvfrom(s,
|
||||||
|
- buf,
|
||||||
|
- len,
|
||||||
|
- 0,
|
||||||
|
- from,
|
||||||
|
- fromlen);
|
||||||
|
-#endif /* SPOOF */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/net_olsr.c olsrd-0.4.10/src/net_olsr.c
|
||||||
|
--- olsrd-0.4.10.orig/src/net_olsr.c 2005-12-29 19:37:16.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/net_olsr.c 2006-12-12 08:59:35.000000000 +0100
|
||||||
|
@@ -526,7 +526,7 @@
|
||||||
|
|
||||||
|
for(;p > 0; p -= 8)
|
||||||
|
{
|
||||||
|
- adr->v6.s6_addr[i] = (p < 8) ? 0xff ^ (0xff << p) : 0xff;
|
||||||
|
+ adr->v6.s6_addr[i] = (p < 8) ? 0xff ^ (0xff >> p) : 0xff;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -564,7 +564,7 @@
|
||||||
|
{
|
||||||
|
for(tmp = adr->v6.s6_addr[i];
|
||||||
|
tmp > 0;
|
||||||
|
- tmp = tmp >> 1)
|
||||||
|
+ tmp = (tmp << 1) & 0xff)
|
||||||
|
prefix++;
|
||||||
|
}
|
||||||
|
}
|
306
net/olsrd/patches/230-olsrd-fixes-backport.patch
Normal file
306
net/olsrd/patches/230-olsrd-fixes-backport.patch
Normal file
@ -0,0 +1,306 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/dot_draw/src/olsrd_dot_draw.c olsrd-0.4.10/lib/dot_draw/src/olsrd_dot_draw.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/dot_draw/src/olsrd_dot_draw.c 2005-12-30 03:23:59.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/dot_draw/src/olsrd_dot_draw.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -136,6 +136,8 @@
|
||||||
|
/* Register the "ProcessChanges" function */
|
||||||
|
register_pcf(&pcf_event);
|
||||||
|
|
||||||
|
+ plugin_ipc_init();
|
||||||
|
+
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -237,6 +239,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
/* Register with olsrd */
|
||||||
|
+ printf("Adding socket with olsrd\n");
|
||||||
|
add_olsr_socket(ipc_socket, &ipc_action);
|
||||||
|
ipc_socket_up = 1;
|
||||||
|
}
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/httpinfo/src/olsrd_httpinfo.c olsrd-0.4.10/lib/httpinfo/src/olsrd_httpinfo.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/httpinfo/src/olsrd_httpinfo.c 2006-12-01 20:20:31.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/httpinfo/src/olsrd_httpinfo.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -297,6 +297,7 @@
|
||||||
|
if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) == -1)
|
||||||
|
{
|
||||||
|
olsr_printf(1, "(HTTPINFO) bind failed %s\n", strerror(errno));
|
||||||
|
+ close(s);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -304,6 +305,7 @@
|
||||||
|
if (listen(s, 1) == -1)
|
||||||
|
{
|
||||||
|
olsr_printf(1, "(HTTPINFO) listen failed %s\n", strerror(errno));
|
||||||
|
+ close(s);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/lib/secure/src/olsrd_secure.c olsrd-0.4.10/lib/secure/src/olsrd_secure.c
|
||||||
|
--- olsrd-0.4.10.orig/lib/secure/src/olsrd_secure.c 2005-11-19 09:37:23.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/secure/src/olsrd_secure.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -952,7 +952,7 @@
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Check configuration timeout */
|
||||||
|
- if(!TIMED_OUT(&entry->conftime))
|
||||||
|
+ if(!TIMED_OUT(entry->conftime))
|
||||||
|
{
|
||||||
|
/* If registered - do not accept! */
|
||||||
|
olsr_printf(1, "[ENC]Challenge from registered node...dropping!\n");
|
||||||
|
@@ -1205,7 +1205,7 @@
|
||||||
|
while(tmp_list != ×tamps[index])
|
||||||
|
{
|
||||||
|
/*Check if the entry is timed out*/
|
||||||
|
- if((TIMED_OUT(&tmp_list->valtime)) && (TIMED_OUT(&tmp_list->conftime)))
|
||||||
|
+ if((TIMED_OUT(tmp_list->valtime)) && (TIMED_OUT(tmp_list->conftime)))
|
||||||
|
{
|
||||||
|
entry_to_delete = tmp_list;
|
||||||
|
tmp_list = tmp_list->next;
|
||||||
|
diff -Nur olsrd-0.4.10.orig/make/Makefile.linux olsrd-0.4.10/make/Makefile.linux
|
||||||
|
--- olsrd-0.4.10.orig/make/Makefile.linux 2005-11-19 09:43:51.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/make/Makefile.linux 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -3,7 +3,11 @@
|
||||||
|
#
|
||||||
|
|
||||||
|
INSTALL_PREFIX ?=
|
||||||
|
+ifeq ($(shell arch),x86_64)
|
||||||
|
+LIBDIR = $(INSTALL_PREFIX)/usr/lib64
|
||||||
|
+else
|
||||||
|
LIBDIR = $(INSTALL_PREFIX)/usr/lib
|
||||||
|
+endif
|
||||||
|
|
||||||
|
SRCS += $(wildcard src/linux/*.c) $(wildcard src/unix/*.c)
|
||||||
|
HDRS += $(wildcard src/linux/*.h) $(wildcard src/unix/*.h)
|
||||||
|
diff -Nur olsrd-0.4.10.orig/make/Makefile.osx olsrd-0.4.10/make/Makefile.osx
|
||||||
|
--- olsrd-0.4.10.orig/make/Makefile.osx 2005-12-29 20:48:43.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/make/Makefile.osx 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -2,6 +2,10 @@
|
||||||
|
# MAC OSX SPECIFIC CONFIGURATION
|
||||||
|
#
|
||||||
|
|
||||||
|
+# don't strip executables and bundles for now until we figure out the proper way
|
||||||
|
+# to do it (flags).
|
||||||
|
+STRIP = \#
|
||||||
|
+
|
||||||
|
INSTALL_PREFIX ?=
|
||||||
|
LIBDIR = $(INSTALL_PREFIX)/usr/lib
|
||||||
|
|
||||||
|
@@ -12,12 +16,10 @@
|
||||||
|
LIBS =
|
||||||
|
|
||||||
|
PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
|
||||||
|
-INSTALL_LIB = install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
|
||||||
|
- /sbin/ldconfig
|
||||||
|
+INSTALL_LIB = install -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME)
|
||||||
|
|
||||||
|
ifdef OLSRD_PLUGIN
|
||||||
|
-CFLAGS += -fPIC
|
||||||
|
-LDFLAGS = -fPIC -dynamiclib -single_module -flat_namespace -undefined suppress
|
||||||
|
+LDFLAGS = -bundle -flat_namespace -undefined suppress
|
||||||
|
else
|
||||||
|
LDFLAGS = -dynamic
|
||||||
|
endif
|
||||||
|
diff -Nur olsrd-0.4.10.orig/Makefile olsrd-0.4.10/Makefile
|
||||||
|
--- olsrd-0.4.10.orig/Makefile 2006-12-01 20:20:31.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/Makefile 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -171,3 +171,4 @@
|
||||||
|
|
||||||
|
build_all: cfgparser olsrd libs
|
||||||
|
install_all: install install_libs
|
||||||
|
+clean_all: uberclean clean_libs
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/bsd/net.c olsrd-0.4.10/src/bsd/net.c
|
||||||
|
--- olsrd-0.4.10.orig/src/bsd/net.c 2005-08-28 21:30:29.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/bsd/net.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -290,6 +290,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* connect to PORT on HOST */
|
||||||
|
@@ -298,6 +299,7 @@
|
||||||
|
printf("FAILED\n");
|
||||||
|
fprintf(stderr, "Error connecting %d - %s\n", errno, strerror(errno));
|
||||||
|
printf("connection refused\n");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -332,6 +334,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -339,12 +342,14 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEPORT failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setsockopt(sock, IPPROTO_IP, IP_RECVIF, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("IP_RECVIF failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
#endif /* SPOOF */
|
||||||
|
@@ -403,6 +408,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/linux/net.c olsrd-0.4.10/src/linux/net.c
|
||||||
|
--- olsrd-0.4.10.orig/src/linux/net.c 2005-09-17 22:48:50.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/linux/net.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -434,6 +434,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* connect to PORT on HOST */
|
||||||
|
@@ -442,6 +443,7 @@
|
||||||
|
printf("FAILED\n");
|
||||||
|
fprintf(stderr, "Error connecting %d - %s\n", errno, strerror(errno));
|
||||||
|
printf("connection refused\n");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -487,6 +489,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -520,6 +523,7 @@
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Could not bind socket to device... exiting!\n\n");
|
||||||
|
syslog(LOG_ERR, "Could not bind socket to device... exiting!\n\n");
|
||||||
|
+ close(sock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -606,6 +610,7 @@
|
||||||
|
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
|
||||||
|
{
|
||||||
|
perror("SO_REUSEADDR failed");
|
||||||
|
+ close(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -619,6 +624,7 @@
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Could not bind socket to device... exiting!\n\n");
|
||||||
|
syslog(LOG_ERR, "Could not bind socket to device... exiting!\n\n");
|
||||||
|
+ close(sock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/main.c olsrd-0.4.10/src/main.c
|
||||||
|
--- olsrd-0.4.10.orig/src/main.c 2006-12-01 20:20:31.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/main.c 2006-12-01 20:23:54.000000000 +0100
|
||||||
|
@@ -118,7 +118,7 @@
|
||||||
|
system_tick_divider = 1000/sysconf(_SC_CLK_TCK);
|
||||||
|
|
||||||
|
/* Check if user is root */
|
||||||
|
- if(getuid() || getgid())
|
||||||
|
+ if(geteuid())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "You must be root(uid = 0) to run olsrd!\nExiting\n\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
@@ -395,6 +395,7 @@
|
||||||
|
signal(SIGHUP, olsr_reconfigure);
|
||||||
|
signal(SIGINT, olsr_shutdown);
|
||||||
|
signal(SIGTERM, olsr_shutdown);
|
||||||
|
+ signal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Register socket poll event */
|
||||||
|
@@ -535,6 +536,7 @@
|
||||||
|
fprintf(stderr, " [-hint <hello interval (secs)>] [-tcint <tc interval (secs)>]\n");
|
||||||
|
fprintf(stderr, " [-midint <mid interval (secs)>] [-hnaint <hna interval (secs)>]\n");
|
||||||
|
fprintf(stderr, " [-T <Polling Rate (secs)>] [-nofork] [-hemu <ip_address>] \n");
|
||||||
|
+ fprintf(stderr, " [-lql <LQ level>] [-lqw <LQ winsize>]\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -635,6 +637,42 @@
|
||||||
|
memcpy(&ifcnf->ipv4_broadcast.v4, &in.s_addr, sizeof(olsr_u32_t));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Set LQ level
|
||||||
|
+ */
|
||||||
|
+ if (strcmp(*argv, "-lql") == 0)
|
||||||
|
+ {
|
||||||
|
+ int tmp_lq_level;
|
||||||
|
+ NEXT_ARG;
|
||||||
|
+ CHECK_ARGC;
|
||||||
|
+
|
||||||
|
+ /* Sanity checking is done later */
|
||||||
|
+ sscanf(*argv, "%d", &tmp_lq_level);
|
||||||
|
+ olsr_cnf->lq_level = tmp_lq_level;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Set LQ winsize
|
||||||
|
+ */
|
||||||
|
+ if (strcmp(*argv, "-lqw") == 0)
|
||||||
|
+ {
|
||||||
|
+ int tmp_lq_wsize;
|
||||||
|
+ NEXT_ARG;
|
||||||
|
+ CHECK_ARGC;
|
||||||
|
+
|
||||||
|
+ sscanf(*argv, "%d", &tmp_lq_wsize);
|
||||||
|
+
|
||||||
|
+ if(tmp_lq_wsize < MIN_LQ_WSIZE || tmp_lq_wsize > MAX_LQ_WSIZE)
|
||||||
|
+ {
|
||||||
|
+ printf("LQ winsize %d not allowed. Range [%d-%d]\n",
|
||||||
|
+ tmp_lq_wsize, MIN_LQ_WSIZE, MAX_LQ_WSIZE);
|
||||||
|
+ olsr_exit(__func__, EXIT_FAILURE);
|
||||||
|
+ }
|
||||||
|
+ olsr_cnf->lq_wsize = tmp_lq_wsize;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable additional debugging information to be logged.
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/scheduler.c olsrd-0.4.10/src/scheduler.c
|
||||||
|
--- olsrd-0.4.10.orig/src/scheduler.c 2006-12-01 20:20:31.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/scheduler.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -330,6 +330,7 @@
|
||||||
|
{
|
||||||
|
prev->next = entry->next;
|
||||||
|
}
|
||||||
|
+ free(entry);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/win32/net.c olsrd-0.4.10/src/win32/net.c
|
||||||
|
--- olsrd-0.4.10.orig/src/win32/net.c 2005-05-30 15:50:27.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/win32/net.c 2006-12-01 20:23:37.000000000 +0100
|
||||||
|
@@ -87,6 +87,7 @@
|
||||||
|
printf("FAILED\n");
|
||||||
|
fprintf(stderr, "Error connecting %d - %s\n", errno, strerror(errno));
|
||||||
|
printf("connection refused\n");
|
||||||
|
+ closesocket(sock);
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
|
137
net/olsrd/patches/240-olsrd-fixes-routedel.patch
Normal file
137
net/olsrd/patches/240-olsrd-fixes-routedel.patch
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/src/link_set.c olsrd-0.4.10/src/link_set.c
|
||||||
|
--- olsrd-0.4.10.orig/src/link_set.c 2006-12-01 09:04:56.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/link_set.c 2006-12-01 09:06:22.000000000 +0100
|
||||||
|
@@ -381,6 +381,69 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
+ *Delete all interface link entries
|
||||||
|
+ *
|
||||||
|
+ *@param interface ip address
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+del_if_link_entries(union olsr_ip_addr *int_addr)
|
||||||
|
+{
|
||||||
|
+ struct link_entry *tmp_link_set, *last_link_entry;
|
||||||
|
+
|
||||||
|
+ if(link_set == NULL)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ tmp_link_set = link_set;
|
||||||
|
+ last_link_entry = NULL;
|
||||||
|
+
|
||||||
|
+ while(tmp_link_set)
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ if(COMP_IP(int_addr, &tmp_link_set->local_iface_addr))
|
||||||
|
+ {
|
||||||
|
+ if(last_link_entry != NULL)
|
||||||
|
+ {
|
||||||
|
+ last_link_entry->next = tmp_link_set->next;
|
||||||
|
+
|
||||||
|
+ /* Delete neighbor entry */
|
||||||
|
+ if(tmp_link_set->neighbor->linkcount == 1)
|
||||||
|
+ olsr_delete_neighbor_table(&tmp_link_set->neighbor->neighbor_main_addr);
|
||||||
|
+ else
|
||||||
|
+ tmp_link_set->neighbor->linkcount--;
|
||||||
|
+
|
||||||
|
+ //olsr_delete_neighbor_if_no_link(&tmp_link_set->neighbor->neighbor_main_addr);
|
||||||
|
+ changes_neighborhood = OLSR_TRUE;
|
||||||
|
+
|
||||||
|
+ free(tmp_link_set);
|
||||||
|
+ tmp_link_set = last_link_entry;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ link_set = tmp_link_set->next; /* CHANGED */
|
||||||
|
+
|
||||||
|
+ /* Delete neighbor entry */
|
||||||
|
+ if(tmp_link_set->neighbor->linkcount == 1)
|
||||||
|
+ olsr_delete_neighbor_table(&tmp_link_set->neighbor->neighbor_main_addr);
|
||||||
|
+ else
|
||||||
|
+ tmp_link_set->neighbor->linkcount--;
|
||||||
|
+
|
||||||
|
+ changes_neighborhood = OLSR_TRUE;
|
||||||
|
+
|
||||||
|
+ free(tmp_link_set);
|
||||||
|
+ tmp_link_set = link_set;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ last_link_entry = tmp_link_set;
|
||||||
|
+ tmp_link_set = tmp_link_set->next;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
*Nothing mysterious here.
|
||||||
|
*Adding a new link entry to the link set.
|
||||||
|
*
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/link_set.h olsrd-0.4.10/src/link_set.h
|
||||||
|
--- olsrd-0.4.10.orig/src/link_set.h 2005-10-23 22:58:14.000000000 +0200
|
||||||
|
+++ olsrd-0.4.10/src/link_set.h 2006-12-01 09:06:22.000000000 +0100
|
||||||
|
@@ -116,6 +116,9 @@
|
||||||
|
void
|
||||||
|
olsr_init_link_set(void);
|
||||||
|
|
||||||
|
+void
|
||||||
|
+del_if_link_entries(union olsr_ip_addr *);
|
||||||
|
+
|
||||||
|
struct link_entry *
|
||||||
|
get_best_link_to_neighbor(union olsr_ip_addr *);
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/linux/kernel_routes.c olsrd-0.4.10/src/linux/kernel_routes.c
|
||||||
|
--- olsrd-0.4.10.orig/src/linux/kernel_routes.c 2005-02-27 19:39:43.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/linux/kernel_routes.c 2006-12-01 09:06:22.000000000 +0100
|
||||||
|
@@ -244,9 +244,8 @@
|
||||||
|
inet_ntop(AF_INET, &destination->rt_mask.v4, mask_str, 16);
|
||||||
|
inet_ntop(AF_INET, &destination->rt_router.v4, router_str, 16);
|
||||||
|
|
||||||
|
- OLSR_PRINTF(1, "(ioctl)Deleting route with metric %d to %s/%s via %s/%s.\n",
|
||||||
|
- destination->rt_metric, dst_str, mask_str, router_str,
|
||||||
|
- destination->rt_if->int_name)
|
||||||
|
+ OLSR_PRINTF(1, "(ioctl)Deleting route with metric %d to %s/%s via %s.\n",
|
||||||
|
+ destination->rt_metric, dst_str, mask_str, router_str)
|
||||||
|
|
||||||
|
memset(&kernel_route,0,sizeof(struct rtentry));
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/lq_packet.c olsrd-0.4.10/src/lq_packet.c
|
||||||
|
--- olsrd-0.4.10.orig/src/lq_packet.c 2006-12-01 09:04:56.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/lq_packet.c 2006-12-01 09:06:22.000000000 +0100
|
||||||
|
@@ -225,8 +225,10 @@
|
||||||
|
|
||||||
|
link = get_best_link_to_neighbor(&neigh->main);
|
||||||
|
|
||||||
|
- neigh->link_quality = link->loss_link_quality;
|
||||||
|
- neigh->neigh_link_quality = link->neigh_link_quality;
|
||||||
|
+ if (link) {
|
||||||
|
+ neigh->link_quality = link->loss_link_quality;
|
||||||
|
+ neigh->neigh_link_quality = link->neigh_link_quality;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
// queue the neighbour entry
|
||||||
|
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/unix/ifnet.c olsrd-0.4.10/src/unix/ifnet.c
|
||||||
|
--- olsrd-0.4.10.orig/src/unix/ifnet.c 2006-12-01 09:04:56.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/unix/ifnet.c 2006-12-01 09:06:22.000000000 +0100
|
||||||
|
@@ -56,6 +56,7 @@
|
||||||
|
#include "mantissa.h"
|
||||||
|
#include "lq_packet.h"
|
||||||
|
#include "log.h"
|
||||||
|
+#include "link_set.h"
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
@@ -393,6 +394,8 @@
|
||||||
|
OLSR_PRINTF(1, "Removing interface %s\n", iface->name)
|
||||||
|
olsr_syslog(OLSR_LOG_INFO, "Removing interface %s\n", iface->name);
|
||||||
|
|
||||||
|
+ del_if_link_entries(&ifp->ip_addr);
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
*Call possible ifchange functions registered by plugins
|
||||||
|
*/
|
36
net/olsrd/patches/250-olsrd-cpu-overload.patch
Normal file
36
net/olsrd/patches/250-olsrd-cpu-overload.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/src/parser.c olsrd-0.4.10/src/parser.c
|
||||||
|
--- olsrd-0.4.10.orig/src/parser.c 2005-11-19 09:49:44.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/parser.c 2006-12-04 09:12:40.000000000 +0100
|
||||||
|
@@ -61,6 +61,14 @@
|
||||||
|
#define strerror(x) StrError(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+/* Sven-Ola: On very slow devices used in huge networks
|
||||||
|
+ * the amount of lq_tc messages is so high, that the
|
||||||
|
+ * recv() loop never ends. This is a small hack to end
|
||||||
|
+ * the loop in this cases
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+unsigned int cpu_overload_exit = 0;
|
||||||
|
+
|
||||||
|
struct parse_function_entry *parse_functions;
|
||||||
|
|
||||||
|
static char inbuf[MAXMESSAGESIZE+1];
|
||||||
|
@@ -347,9 +355,16 @@
|
||||||
|
int cc;
|
||||||
|
struct interface *olsr_in_if;
|
||||||
|
union olsr_ip_addr from_addr;
|
||||||
|
-
|
||||||
|
+ cpu_overload_exit = 0;
|
||||||
|
+
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
+ if (32 < ++cpu_overload_exit)
|
||||||
|
+ {
|
||||||
|
+ OLSR_PRINTF(1, "CPU overload detected, ending olsr_input() loop\n")
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
fromlen = sizeof(struct sockaddr_storage);
|
||||||
|
|
||||||
|
cc = olsr_recvfrom(fd,
|
12
net/olsrd/patches/260-olsrd-secure_key_path.patch
Normal file
12
net/olsrd/patches/260-olsrd-secure_key_path.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/lib/secure/src/olsrd_secure.h olsrd-0.4.10/lib/secure/src/olsrd_secure.h
|
||||||
|
--- olsrd-0.4.10.orig/lib/secure/src/olsrd_secure.h 2005-11-19 09:30:45.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/lib/secure/src/olsrd_secure.h 2006-12-01 08:50:41.000000000 +0100
|
||||||
|
@@ -46,7 +46,7 @@
|
||||||
|
#include "hashing.h"
|
||||||
|
|
||||||
|
|
||||||
|
-#define KEYFILE "/root/.olsr/olsrd_secure_key"
|
||||||
|
+#define KEYFILE "/etc/olsrd.d/olsrd_secure_key"
|
||||||
|
|
||||||
|
/* Schemes */
|
||||||
|
#define ONE_CHECKSUM 1
|
22
net/olsrd/patches/270-olsrd-hna_ip_fix.patch
Normal file
22
net/olsrd/patches/270-olsrd-hna_ip_fix.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
diff -Nur olsrd-0.4.10.orig/src/cfgparser/oparse.c olsrd-0.4.10/src/cfgparser/oparse.c
|
||||||
|
--- olsrd-0.4.10.orig/src/cfgparser/oparse.c 2006-01-01 17:15:57.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/cfgparser/oparse.c 2006-12-01 08:21:39.000000000 +0100
|
||||||
|
@@ -1921,6 +1921,7 @@
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
h->netmask.v4 = in.s_addr;
|
||||||
|
+ h->net.v4 &= h->netmask.v4;
|
||||||
|
/* Queue */
|
||||||
|
h->next = cnf->hna4_entries;
|
||||||
|
cnf->hna4_entries = h;
|
||||||
|
diff -Nur olsrd-0.4.10.orig/src/cfgparser/oparse.y olsrd-0.4.10/src/cfgparser/oparse.y
|
||||||
|
--- olsrd-0.4.10.orig/src/cfgparser/oparse.y 2005-11-17 05:25:44.000000000 +0100
|
||||||
|
+++ olsrd-0.4.10/src/cfgparser/oparse.y 2006-12-01 08:23:05.000000000 +0100
|
||||||
|
@@ -701,6 +701,7 @@
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
h->netmask.v4 = in.s_addr;
|
||||||
|
+ h->net.v4 &= h->netmask.v4;
|
||||||
|
/* Queue */
|
||||||
|
h->next = cnf->hna4_entries;
|
||||||
|
cnf->hna4_entries = h;
|
Loading…
x
Reference in New Issue
Block a user