diff -Nur olsrd-0.5.3.orig/lib/nameservice/src/nameservice.c olsrd-0.5.3/lib/nameservice/src/nameservice.c
--- olsrd-0.5.3.orig/lib/nameservice/src/nameservice.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/lib/nameservice/src/nameservice.c	2007-09-16 20:56:24.000000000 +0200
@@ -383,7 +383,7 @@
 
 	/* register functions with olsrd */
 	olsr_parser_add_function(&olsr_parser, PARSER_TYPE, 1);
-	olsr_register_timeout_function(&olsr_timeout);
+	olsr_register_timeout_function(&olsr_timeout, OLSR_TRUE);
 	olsr_register_scheduler_event(&olsr_event, NULL, my_interval, 0, NULL);
 
 	return 1;
@@ -485,18 +485,35 @@
  * time out old list entries
  * and write changes to file
  */
+
+static int timeout_roundrobin = 0;
+
 void
 olsr_timeout(void)
 {
-	timeout_old_names(list, &name_table_changed);
-	timeout_old_names(forwarder_list, &forwarder_table_changed);
-	timeout_old_names(service_list, &service_table_changed);
-	timeout_old_names(latlon_list, &latlon_table_changed);
-
-	write_resolv_file();
-	write_hosts_file();
-	write_services_file();
-	write_latlon_file();
+	switch(timeout_roundrobin++)
+	{
+		case 0:
+			timeout_old_names(list, &name_table_changed);
+			timeout_old_names(forwarder_list, &forwarder_table_changed);
+			timeout_old_names(service_list, &service_table_changed);
+			timeout_old_names(latlon_list, &latlon_table_changed);
+			break;
+		case 1:
+			write_resolv_file(); // if forwarder_table_changed
+			break;
+		case 2:
+			write_hosts_file(); // if name_table_changed
+			break;
+		case 3:
+			write_services_file(); // if service_table_changed
+			break;
+		case 4:
+			write_latlon_file(); // latlon_table_changed
+			break;
+		default:
+			timeout_roundrobin = 0;
+	} // switch
 }
 
 void
diff -Nur olsrd-0.5.3.orig/lib/quagga/src/olsrd_plugin.c olsrd-0.5.3/lib/quagga/src/olsrd_plugin.c
--- olsrd-0.5.3.orig/lib/quagga/src/olsrd_plugin.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/lib/quagga/src/olsrd_plugin.c	2007-09-16 20:56:24.000000000 +0200
@@ -97,7 +97,6 @@
     return 1;
   }
 
-  //  olsr_register_timeout_function(&olsr_timeout);
   olsr_register_scheduler_event(&zebra_check, NULL, 1, 0, NULL);
   return 0;
 }
diff -Nur olsrd-0.5.3.orig/lib/tas/src/plugin.c olsrd-0.5.3/lib/tas/src/plugin.c
--- olsrd-0.5.3.orig/lib/tas/src/plugin.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/lib/tas/src/plugin.c	2007-09-16 20:56:24.000000000 +0200
@@ -483,7 +483,7 @@
 
   httpInit();
   
-  olsr_register_timeout_function(serviceFunc);
+  olsr_register_timeout_function(serviceFunc, OLSR_FALSE);
   olsr_parser_add_function(parserFunc, MESSAGE_TYPE, 1);
 
   return 0;
diff -Nur olsrd-0.5.3.orig/src/duplicate_set.c olsrd-0.5.3/src/duplicate_set.c
--- olsrd-0.5.3.orig/src/duplicate_set.c	2007-04-26 00:08:07.000000000 +0200
+++ olsrd-0.5.3/src/duplicate_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -66,7 +66,7 @@
   /* Since the holdingtime is rather large for duplicate
    * entries the timeoutfunction is only ran every 2 seconds
    */
-  olsr_register_scheduler_event(&olsr_time_out_duplicate_table, NULL, 2, 0, NULL);
+  olsr_register_scheduler_event_dijkstra(&olsr_time_out_duplicate_table, NULL, 2, 0, NULL);
   
   for(i = 0; i < HASHSIZE; i++)
     {
diff -Nur olsrd-0.5.3.orig/src/hna_set.c olsrd-0.5.3/src/hna_set.c
--- olsrd-0.5.3.orig/src/hna_set.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/hna_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -69,7 +69,7 @@
   /* Since the holdingtime is assumed to be rather large for 
    * HNA entries, the timeoutfunction is only ran once every second
    */
-  olsr_register_scheduler_event(&olsr_time_out_hna_set, NULL, 1, 0, NULL);
+  olsr_register_scheduler_event_dijkstra(&olsr_time_out_hna_set, NULL, 1, 0, NULL);
 
   for(idx=0;idx<HASHSIZE;idx++)
     {
diff -Nur olsrd-0.5.3.orig/src/link_set.c olsrd-0.5.3/src/link_set.c
--- olsrd-0.5.3.orig/src/link_set.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/link_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -97,15 +97,15 @@
   /* Timers */
   hold_time_neighbor = (NEIGHB_HOLD_TIME*1000) / olsr_cnf->system_tick_divider;
 
-  olsr_register_timeout_function(&olsr_time_out_link_set);
+  olsr_register_timeout_function(&olsr_time_out_link_set, OLSR_TRUE);
   if(olsr_cnf->use_hysteresis)
     {
-      olsr_register_timeout_function(&olsr_time_out_hysteresis);
+      olsr_register_timeout_function(&olsr_time_out_hysteresis, OLSR_TRUE);
     }
 
   if (olsr_cnf->lq_level > 0)
     {
-      olsr_register_timeout_function(&olsr_time_out_packet_loss);
+      olsr_register_timeout_function(&olsr_time_out_packet_loss, OLSR_TRUE);
     }
 }
 
diff -Nur olsrd-0.5.3.orig/src/main.c olsrd-0.5.3/src/main.c
--- olsrd-0.5.3.orig/src/main.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/main.c	2007-09-16 20:56:24.000000000 +0200
@@ -402,7 +402,7 @@
 #endif
 
   /* Register socket poll event */
-  olsr_register_timeout_function(&poll_sockets);
+  olsr_register_timeout_function(&poll_sockets, OLSR_FALSE);
 
   /* Starting scheduler */
   scheduler();
diff -Nur olsrd-0.5.3.orig/src/mid_set.c olsrd-0.5.3/src/mid_set.c
--- olsrd-0.5.3.orig/src/mid_set.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/mid_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -69,7 +69,7 @@
   /* Since the holdingtime is assumed to be rather large for 
    * MID entries, the timeoutfunction is only ran once every second
    */
-  olsr_register_scheduler_event(&olsr_time_out_mid_set, NULL, 1, 0, NULL);
+  olsr_register_scheduler_event_dijkstra(&olsr_time_out_mid_set, NULL, 1, 0, NULL);
 
   for(idx=0;idx<HASHSIZE;idx++)
     {
diff -Nur olsrd-0.5.3.orig/src/mpr_selector_set.c olsrd-0.5.3/src/mpr_selector_set.c
--- olsrd-0.5.3.orig/src/mpr_selector_set.c	2007-04-26 00:08:09.000000000 +0200
+++ olsrd-0.5.3/src/mpr_selector_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -61,7 +61,7 @@
   /* Initial values */
   ansn = 0;
 
-  olsr_register_timeout_function(&olsr_time_out_mprs_set);
+  olsr_register_timeout_function(&olsr_time_out_mprs_set, OLSR_TRUE);
   
   mprs_list.next = &mprs_list;
   mprs_list.prev = &mprs_list;
diff -Nur olsrd-0.5.3.orig/src/neighbor_table.c olsrd-0.5.3/src/neighbor_table.c
--- olsrd-0.5.3.orig/src/neighbor_table.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/neighbor_table.c	2007-09-16 20:56:24.000000000 +0200
@@ -60,7 +60,7 @@
 {
   int i;
 
-  olsr_register_timeout_function(&olsr_time_out_neighborhood_tables);
+  olsr_register_timeout_function(&olsr_time_out_neighborhood_tables, OLSR_TRUE);
   for(i = 0; i < HASHSIZE; i++)
     {
       neighbortable[i].next = &neighbortable[i];
diff -Nur olsrd-0.5.3.orig/src/scheduler.c olsrd-0.5.3/src/scheduler.c
--- olsrd-0.5.3.orig/src/scheduler.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/scheduler.c	2007-09-16 20:56:24.000000000 +0200
@@ -326,7 +326,7 @@
       if((entry->function == event_function) &&
 	 (entry->param == par) &&
 	 (entry->trigger == trigger) &&
-	 (entry->interval == interval))
+	 (0.0 > interval || entry->interval == interval))
 	{
 	  if(entry == event_functions)
 	    {
@@ -347,12 +347,49 @@
   return 0;
 }
 
+/*
+ * Sven-Ola, 2007: Since the original timing and flagging is changed (which
+ * saves lots of CPU time - see LinkQualityDijkstraLimit) the original timeout
+ * functions called every olsr_cnf->polltime uses too much CPU now. Because the
+ * changes_xxx handling is switched off with LQDL, it should be OK to call
+ * all timeout handlers at a much lower rate. To overcome UDP packet loss,
+ * a very low pollrate is used.
+ */
+
+static int num = 0;
+static float dijkstra_initial = 0.0;
+
+int
+olsr_register_scheduler_event_dijkstra(void (*event_function)(void *), 
+			      void *par,
+			      float interval, 
+			      float initial, 
+			      olsr_u8_t *trigger)
+{
+  if (1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter)
+  {
+    dijkstra_initial += olsr_cnf->lq_dinter / 10.0;
+    return olsr_register_scheduler_event(event_function, par, olsr_cnf->lq_dinter, dijkstra_initial, trigger);
+  }
+  return olsr_register_scheduler_event(event_function, par, interval, initial, trigger);
+}
 
 int
-olsr_register_timeout_function(void (*time_out_function)(void))
+olsr_register_timeout_function(void (*time_out_function)(void), olsr_bool dijkstra_limit_ok)
 {
   struct timeout_entry *new_entry;
 
+  if (dijkstra_limit_ok && 1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter)
+  {
+    dijkstra_initial += olsr_cnf->lq_dinter / 10.0;
+    return olsr_register_scheduler_event(
+      (void *)time_out_function,
+      NULL,
+      olsr_cnf->lq_dinter,
+      dijkstra_initial,
+      NULL);
+  }
+  
   /* check that this entry is not added already */
   new_entry = timeout_functions;
   while(new_entry)
@@ -379,10 +416,20 @@
 
 
 int
-olsr_remove_timeout_function(void (*time_out_function)(void))
+olsr_remove_timeout_function(void (*time_out_function)(void), olsr_bool dijkstra_limit_ok)
 {
   struct timeout_entry *entry, *prev;
 
+  if (dijkstra_limit_ok && 1 < olsr_cnf->lq_level && 0.0 < olsr_cnf->lq_dinter)
+  {
+    return olsr_remove_scheduler_event(
+      (void *)time_out_function,
+      NULL,
+      -1.0,
+      -1.0,
+      NULL);
+  }
+  
   /* check that this entry is not added already */
   entry = timeout_functions;
   prev = NULL;
diff -Nur olsrd-0.5.3.orig/src/scheduler.h olsrd-0.5.3/src/scheduler.h
--- olsrd-0.5.3.orig/src/scheduler.h	2007-04-20 15:46:04.000000000 +0200
+++ olsrd-0.5.3/src/scheduler.h	2007-09-16 20:56:24.000000000 +0200
@@ -72,10 +72,13 @@
 signal_link_changes(olsr_bool);
 
 int
-olsr_register_timeout_function(void (*)(void));
+olsr_register_timeout_function(void (*)(void), olsr_bool);
 
 int
-olsr_remove_timeout_function(void (*)(void));
+olsr_remove_timeout_function(void (*)(void), olsr_bool);
+
+int
+olsr_register_scheduler_event_dijkstra(void (*)(void *), void *, float, float, olsr_u8_t *);
 
 int
 olsr_register_scheduler_event(void (*)(void *), void *, float, float, olsr_u8_t *);
diff -Nur olsrd-0.5.3.orig/src/tc_set.c olsrd-0.5.3/src/tc_set.c
--- olsrd-0.5.3.orig/src/tc_set.c	2007-09-16 20:56:24.000000000 +0200
+++ olsrd-0.5.3/src/tc_set.c	2007-09-16 20:56:24.000000000 +0200
@@ -60,7 +60,7 @@
   int idx;
   OLSR_PRINTF(5, "TC: init topo\n");
 
-  olsr_register_timeout_function(&olsr_time_out_tc_set);
+  olsr_register_timeout_function(&olsr_time_out_tc_set, OLSR_TRUE);
 
   for(idx=0;idx<HASHSIZE;idx++)
     {
