rename olsrd patches, add fixes and optimizations from sven-ola
authorFelix Fietkau <nbd@openwrt.org>
Sun, 8 Oct 2006 17:04:09 +0000 (17:04 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 8 Oct 2006 17:04:09 +0000 (17:04 +0000)
SVN-Revision: 4965

openwrt/package/olsrd/patches/100-debug_level.patch [new file with mode: 0644]
openwrt/package/olsrd/patches/110-opt_flags.patch [new file with mode: 0644]
openwrt/package/olsrd/patches/120-secure_key_path.patch [new file with mode: 0644]
openwrt/package/olsrd/patches/130-olsrd_fixes.patch [new file with mode: 0644]
openwrt/package/olsrd/patches/140-olsrd_optimize.patch [new file with mode: 0644]
openwrt/package/olsrd/patches/olsrd-0.4.10-debug_level.patch [deleted file]
openwrt/package/olsrd/patches/olsrd-0.4.10-opt-flags.diff [deleted file]
openwrt/package/olsrd/patches/olsrd-0.4.9-secure-key-path.path [deleted file]

diff --git a/openwrt/package/olsrd/patches/100-debug_level.patch b/openwrt/package/olsrd/patches/100-debug_level.patch
new file mode 100644 (file)
index 0000000..d04272e
--- /dev/null
@@ -0,0 +1,11 @@
+--- olsrd-0.4.10/files/olsrd.conf.default.rfc  2005-06-04 17:34:05.000000000 +0200
++++ olsrd-0.4.10.new/files/olsrd.conf.default.rfc      2006-05-21 21:44:55.000000000 +0200
+@@ -9,7 +9,7 @@
+ # Debug level(0-9)
+ # If set to 0 the daemon runs in the background
+-DebugLevel    1
++DebugLevel    0
+ # IP version to use (4 or 6)
diff --git a/openwrt/package/olsrd/patches/110-opt_flags.patch b/openwrt/package/olsrd/patches/110-opt_flags.patch
new file mode 100644 (file)
index 0000000..02d1cc8
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ruN olsrd-0.4.10-old/Makefile.inc olsrd-0.4.10-new/Makefile.inc
+--- olsrd-0.4.10-old/Makefile.inc      2006-01-01 16:58:20.000000000 +0100
++++ olsrd-0.4.10-new/Makefile.inc      2006-01-05 17:57:23.000000000 +0100
+@@ -21,7 +21,7 @@
+ ifndef CFLAGS
+ CFLAGS +=     -Wall -Wmissing-prototypes -Wstrict-prototypes \
+               -Wmissing-declarations -Wsign-compare
+-CFLAGS +=     -O2 -g
++CFLAGS +=     $(OFLAGS)
+ endif
+ ifdef OLSRD_PLUGIN
diff --git a/openwrt/package/olsrd/patches/120-secure_key_path.patch b/openwrt/package/olsrd/patches/120-secure_key_path.patch
new file mode 100644 (file)
index 0000000..fcae759
--- /dev/null
@@ -0,0 +1,12 @@
+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
diff --git a/openwrt/package/olsrd/patches/130-olsrd_fixes.patch b/openwrt/package/olsrd/patches/130-olsrd_fixes.patch
new file mode 100644 (file)
index 0000000..8a9794a
--- /dev/null
@@ -0,0 +1,134 @@
+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/src/defs.h    2006-03-02 02:10:02.000000000 +0100
+@@ -71,7 +71,7 @@
+ #define       HOPCNT_MAX              32      /* maximum hops number */
+ #define       MAXMESSAGESIZE          1500    /* max broadcast size */
+ #define UDP_IPV4_HDRSIZE        28
+-#define UDP_IPV6_HDRSIZE        48
++#define UDP_IPV6_HDRSIZE        62
+ #define MAX_IFS                 16
+ /* Debug helper macro */
+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/src/link_set.c        2006-03-02 02:10:02.000000000 +0100
+@@ -952,8 +952,9 @@
+   entry->loss_link_quality =
+     (float)(entry->total_packets - entry->lost_packets) /
+-    (float)(entry->loss_window_size);
+-
++    (float)(entry->loss_window_size < (2 * 4) ? entry->loss_window_size: 
++    4 * ((entry->loss_window_size / 4 - 1) * entry->total_packets + entry->loss_window_size) / entry->loss_window_size);
++    
+   // multiply the calculated link quality with the user-specified 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
+--- 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-03-02 02:10:02.000000000 +0100
+@@ -149,7 +149,8 @@
+   int i;
+   struct neighbor_entry *walker;
+   struct link_entry *link;
+-  static int ttl_list[] = { MAX_TTL, 3, 2, 1, 2, 1, 1, 3, 2, 1, 2, 1, 1, 0 };
++  static int ttl_list[] = { 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, MAX_TTL-1, 0};
++  
+   static int ttl_index = 0;
+   // remember that we have generated an LQ TC message; this is
+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/src/olsr.c    2006-03-02 02:16:42.000000000 +0100
+@@ -68,6 +68,7 @@
+ olsr_bool changes_topology;
+ olsr_bool changes_neighborhood;
+ olsr_bool changes_hna;
++olsr_bool changes_force;
+ /**
+  * Process changes functions
+@@ -142,6 +143,11 @@
+     OLSR_PRINTF(3, "CHANGES IN HNA\n")
+ #endif
+   
++  if(!changes_force &&
++     2 <= olsr_cnf->lq_level &&
++     0 >= olsr_cnf->lq_dlimit)
++    return;
++    
+   if(!changes_neighborhood &&
+      !changes_topology &&
+      !changes_hna)
+@@ -171,11 +177,6 @@
+           olsr_calculate_routing_table();
+           olsr_calculate_hna_routes();
+         }
+-
+-      else
+-        {
+-          olsr_calculate_lq_routing_table();
+-        }
+     }
+   
+   else if (changes_topology)
+@@ -187,11 +188,6 @@
+           olsr_calculate_routing_table();
+           olsr_calculate_hna_routes();
+         }
+-
+-      else
+-        {
+-          olsr_calculate_lq_routing_table();
+-        }
+     }
+   else if (changes_hna)
+@@ -202,11 +198,11 @@
+         {
+           olsr_calculate_hna_routes();
+         }
+-
+-      else
+-        {
+-          olsr_calculate_lq_routing_table();
+-        }
++    }
++  
++  if (olsr_cnf->lq_level >= 2)
++    {
++      olsr_calculate_lq_routing_table();
+     }
+   
+   if (olsr_cnf->debug_level > 0)
+@@ -239,6 +235,7 @@
+   changes_neighborhood = OLSR_FALSE;
+   changes_topology = OLSR_FALSE;
+   changes_hna = OLSR_FALSE;
++  changes_force = OLSR_FALSE;
+   return;
+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/src/olsr.h    2006-03-02 02:13:02.000000000 +0100
+@@ -49,6 +49,7 @@
+ extern olsr_bool changes_topology;
+ extern olsr_bool changes_neighborhood;
+ extern olsr_bool changes_hna;
++extern olsr_bool changes_force;
+ void
+ register_pcf(int (*)(int, int, int));
+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/src/scheduler.c       2006-03-02 02:12:40.000000000 +0100
+@@ -70,6 +70,7 @@
+   changes_neighborhood = OLSR_TRUE;
+   changes_topology = OLSR_TRUE;
++  changes_force = OLSR_TRUE;
+ }
+ /**
diff --git a/openwrt/package/olsrd/patches/140-olsrd_optimize.patch b/openwrt/package/olsrd/patches/140-olsrd_optimize.patch
new file mode 100644 (file)
index 0000000..4b7986f
--- /dev/null
@@ -0,0 +1,229 @@
+diff -Nur olsrd-0.4.10.orig/src/duplicate_set.c olsrd-0.4.10/src/duplicate_set.c
+--- olsrd-0.4.10.orig/src/duplicate_set.c      2005-02-27 19:39:43.000000000 +0100
++++ olsrd-0.4.10/src/duplicate_set.c   2006-02-22 12:24:03.000000000 +0100
+@@ -93,7 +93,7 @@
+   /* Hash the senders address */
+-  hash = olsr_hashing(originator);
++  hash = HASHMASK & seqno;
+   new_dup_entry = olsr_malloc(sizeof(struct dup_entry), "New dup entry");
+@@ -131,7 +131,7 @@
+   struct dup_entry *tmp_dup_table;
+   /* Hash the senders address */
+-  hash = olsr_hashing(originator);
++  hash = HASHMASK & seqno;
+   /* Check for entry */
+   for(tmp_dup_table = dup_set[hash].next;
+@@ -163,7 +163,7 @@
+   struct dup_entry *tmp_dup_table;
+   /* Hash the senders address */
+-  hash = olsr_hashing(originator);
++  hash = HASHMASK & seqno;
+   /* Check for entry */
+   for(tmp_dup_table = dup_set[hash].next;
+@@ -268,7 +268,7 @@
+   struct dup_iface *new_iface;
+   /* Hash the senders address */
+-  hash = olsr_hashing(originator);
++  hash = HASHMASK & seqno;
+   /* Check for entry */
+@@ -313,7 +313,7 @@
+   struct dup_entry *tmp_dup_table;
+   /* Hash the senders address */
+-  hash = olsr_hashing(originator);
++  hash = HASHMASK & seqno;
+   /* Check for entry */
+   for(tmp_dup_table = dup_set[hash].next;
+diff -Nur olsrd-0.4.10.orig/src/hashing.c olsrd-0.4.10/src/hashing.c
+--- olsrd-0.4.10.orig/src/hashing.c    2005-02-20 19:52:18.000000000 +0100
++++ olsrd-0.4.10/src/hashing.c 2006-02-22 12:23:24.000000000 +0100
+@@ -58,7 +58,7 @@
+   if(olsr_cnf->ip_version == AF_INET)
+     /* IPv4 */  
+-    hash = (ntohl(address->v4));
++    hash = address->v4x[0] ^ address->v4x[1] ^ address->v4x[2] ^ address->v4x[3];
+   else
+     {
+       /* IPv6 */
+diff -Nur olsrd-0.4.10.orig/src/hashing.h olsrd-0.4.10/src/hashing.h
+--- olsrd-0.4.10.orig/src/hashing.h    2005-02-20 19:52:18.000000000 +0100
++++ olsrd-0.4.10/src/hashing.h 2006-02-22 12:23:14.000000000 +0100
+@@ -43,7 +43,7 @@
+ #ifndef _OLSR_HASHING
+ #define _OLSR_HASHING
+-#define       HASHSIZE        32
++#define       HASHSIZE        128
+ #define       HASHMASK        (HASHSIZE - 1)
+ #include "olsr_types.h"
+diff -Nur olsrd-0.4.10.orig/src/lq_avl.c olsrd-0.4.10/src/lq_avl.c
+--- olsrd-0.4.10.orig/src/lq_avl.c     2005-01-22 15:30:57.000000000 +0100
++++ olsrd-0.4.10/src/lq_avl.c  2006-02-22 12:22:12.000000000 +0100
+@@ -40,6 +40,7 @@
+  */
+ #include <stddef.h>
++#include <time.h>
+ #include "lq_avl.h"
+@@ -52,11 +55,29 @@
+   tree->comp = comp;
+ }
++static struct avl_node *avl_find_rec_ipv4(struct avl_node *node, void *key)
++{
++  if (*(unsigned int *)key < *(unsigned int *)node->key) {
++    if (node->left != NULL) {
++      return avl_find_rec_ipv4(node->left, key);
++    }
++  }
++  else if (*(unsigned int *)key > *(unsigned int *)node->key) {
++    if (node->right != NULL) {
++      return avl_find_rec_ipv4(node->right, key);
++    }
++  }
++  return node;
++}
++
+ static struct avl_node *avl_find_rec(struct avl_node *node, void *key,
+                                      int (*comp)(void *, void *))
+ {
+   int diff;
++  if (0 == comp) {
++    return avl_find_rec_ipv4(node, key);
++  }
+   diff = (*comp)(key, node->key);
+   if (diff < 0)
+@@ -87,6 +112,11 @@
+   node = avl_find_rec(tree->root, key, tree->comp);
++  if (0 == tree->comp) {
++    if (0 != svenola_avl_comp_ipv4(node->key, key))
++      return NULL;
++  }
++  else
+   if ((*tree->comp)(node->key, key) != 0)
+     return NULL;
+@@ -228,6 +260,10 @@
+   node = avl_find_rec(tree->root, new->key, tree->comp);
++  if (0 == tree->comp) {
++    diff = svenola_avl_comp_ipv4(new->key, node->key);
++  }
++  else
+   diff = (*tree->comp)(new->key, node->key);
+   if (diff == 0)
+diff -Nur olsrd-0.4.10.orig/src/lq_avl.h olsrd-0.4.10/src/lq_avl.h
+--- olsrd-0.4.10.orig/src/lq_avl.h     2005-02-20 19:52:18.000000000 +0100
++++ olsrd-0.4.10/src/lq_avl.h  2006-02-22 12:22:12.000000000 +0100
+@@ -62,4 +62,7 @@
+ struct avl_node *avl_find(struct avl_tree *, void *);
+ int avl_insert(struct avl_tree *, struct avl_node *);
++#define svenola_avl_comp_ipv4(ip1, ip2) \
++  (*(unsigned int *)ip1 == *(unsigned int *)ip2 ? 0 : \
++  *(unsigned int *)ip1 < *(unsigned int *)ip2 ? -1 : +1)
+ #endif
+diff -Nur olsrd-0.4.10.orig/src/lq_list.c olsrd-0.4.10/src/lq_list.c
+--- olsrd-0.4.10.orig/src/lq_list.c    2004-12-04 18:06:57.000000000 +0100
++++ olsrd-0.4.10/src/lq_list.c 2006-02-22 12:22:12.000000000 +0100
+@@ -48,6 +48,7 @@
+   list->tail = NULL;
+ }
++#if 0
+ struct list_node *list_get_head(struct list *list)
+ {
+   return list->head;
+@@ -67,6 +68,7 @@
+ {
+   return node->prev;
+ }
++#endif
+ void list_add_head(struct list *list, struct list_node *node)
+ {
+diff -Nur olsrd-0.4.10.orig/src/lq_list.h olsrd-0.4.10/src/lq_list.h
+--- olsrd-0.4.10.orig/src/lq_list.h    2005-02-20 19:52:18.000000000 +0100
++++ olsrd-0.4.10/src/lq_list.h 2006-02-22 12:22:12.000000000 +0100
+@@ -58,11 +58,18 @@
+ void list_init(struct list *list);
++#if 1
++#define list_get_head(node) (node)->head
++#define list_get_tail(node) (node)->tail
++#define list_get_next(node) (node)->next
++#define list_get_prev(node) (node)->prev
++#else
+ struct list_node *list_get_head(struct list *list);
+ struct list_node *list_get_tail(struct list *list);
+ struct list_node *list_get_next(struct list_node *node);
+ struct list_node *list_get_prev(struct list_node *node);
++#endif
+ void list_add_head(struct list *list, struct list_node *node);
+ void list_add_tail(struct list *list, struct list_node *node);
+diff -Nur olsrd-0.4.10.orig/src/lq_route.c olsrd-0.4.10/src/lq_route.c
+--- olsrd-0.4.10.orig/src/lq_route.c   2005-11-29 19:37:58.000000000 +0100
++++ olsrd-0.4.10/src/lq_route.c        2006-02-22 12:22:12.000000000 +0100
+@@ -205,6 +205,14 @@
+   // add the vertex to the list, if it's not us
++  if (0 == comp) {
++    if (svenola_avl_comp_ipv4(&main_addr, node->key) != 0)
++    {
++      vert->node.data = vert;
++      list_add_tail(vertex_list, &vert->node);
++    }
++  }
++  else
+   if ((*comp)(&main_addr, node->key) != 0)
+   {
+     vert->node.data = vert;
+@@ -371,7 +381,11 @@
+   struct interface *inter;
+   if (ipsize == 4)
++#if 1
++    avl_comp = 0;
++#else
+     avl_comp = avl_comp_ipv4;
++#endif
+   else
+     avl_comp = avl_comp_ipv6;
+diff -Nur olsrd-0.4.10.orig/src/olsr_types.h olsrd-0.4.10/src/olsr_types.h
+--- olsrd-0.4.10.orig/src/olsr_types.h 2005-05-15 14:57:24.000000000 +0200
++++ olsrd-0.4.10/src/olsr_types.h      2006-02-22 12:22:43.000000000 +0100
+@@ -93,6 +93,7 @@
+ union olsr_ip_addr
+ {
+   olsr_u32_t v4;
++  olsr_u8_t v4x[4];
+   struct in6_addr v6;
+ };
diff --git a/openwrt/package/olsrd/patches/olsrd-0.4.10-debug_level.patch b/openwrt/package/olsrd/patches/olsrd-0.4.10-debug_level.patch
deleted file mode 100644 (file)
index d04272e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
---- olsrd-0.4.10/files/olsrd.conf.default.rfc  2005-06-04 17:34:05.000000000 +0200
-+++ olsrd-0.4.10.new/files/olsrd.conf.default.rfc      2006-05-21 21:44:55.000000000 +0200
-@@ -9,7 +9,7 @@
- # Debug level(0-9)
- # If set to 0 the daemon runs in the background
--DebugLevel    1
-+DebugLevel    0
- # IP version to use (4 or 6)
diff --git a/openwrt/package/olsrd/patches/olsrd-0.4.10-opt-flags.diff b/openwrt/package/olsrd/patches/olsrd-0.4.10-opt-flags.diff
deleted file mode 100644 (file)
index 02d1cc8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ruN olsrd-0.4.10-old/Makefile.inc olsrd-0.4.10-new/Makefile.inc
---- olsrd-0.4.10-old/Makefile.inc      2006-01-01 16:58:20.000000000 +0100
-+++ olsrd-0.4.10-new/Makefile.inc      2006-01-05 17:57:23.000000000 +0100
-@@ -21,7 +21,7 @@
- ifndef CFLAGS
- CFLAGS +=     -Wall -Wmissing-prototypes -Wstrict-prototypes \
-               -Wmissing-declarations -Wsign-compare
--CFLAGS +=     -O2 -g
-+CFLAGS +=     $(OFLAGS)
- endif
- ifdef OLSRD_PLUGIN
diff --git a/openwrt/package/olsrd/patches/olsrd-0.4.9-secure-key-path.path b/openwrt/package/olsrd/patches/olsrd-0.4.9-secure-key-path.path
deleted file mode 100644 (file)
index fcae759..0000000
+++ /dev/null
@@ -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