[Olsr-dev] backoff timer for routing table calculation

Giovanni Di Stasi (spam-protected)
Tue Mar 19 14:57:11 CET 2013


Dear olsr developers,

I have a doubt related to the way the backoff timer is used for routing 
table calculation (a side effect due to its use).

The problem I see is that the information about the changes in topology 
(changes_neighborhood, changes_hna, ...)   that happen while the backoff 
timer is on are lost so when the timer expires a new routing table 
calculation is not triggered even if the state of the network has 
changed in the meantime. This can lead to packet losses as the routing 
table does not reflect the state of the network. The routing table is 
fixed only later when a new event occurs (which can be even several 
seconds later).

I propose the attached patch that I would be glad if you could revise 
and discuss with me.

Best regards,
Giovanni


diff --git a/src/olsr.c b/src/olsr.c
index 10b4ee3..c6cd42c 100644
--- a/src/olsr.c
+++ b/src/olsr.c
@@ -74,6 +74,7 @@ bool changes_topology;
  bool changes_neighborhood;
  bool changes_hna;
  bool changes_force;
+bool pending_change;

  /*COLLECT startup sleeps caused by warnings*/

@@ -189,7 +190,7 @@ olsr_process_changes(void)
      OLSR_PRINTF(3, "CHANGES IN HNA\n");
  #endif /* DEBUG */

-  if (!changes_neighborhood && !changes_topology && !changes_hna)
+  if (!changes_neighborhood && !changes_topology && !changes_hna && 
!changes_force)
      return;

    if (olsr_cnf->debug_level > 0 && olsr_cnf->clear_screen && isatty(1)) {
@@ -206,7 +207,7 @@ olsr_process_changes(void)
    }

    /* calculate the routing table */
-  if (changes_neighborhood || changes_topology || changes_hna) {
+  if (changes_neighborhood || changes_topology || changes_hna || 
changes_force) {
      olsr_calculate_routing_table(false);
    }

diff --git a/src/olsr.h b/src/olsr.h
index 0454739..a9aaa30 100644
--- a/src/olsr.h
+++ b/src/olsr.h
@@ -49,6 +49,7 @@ extern bool changes_topology;
  extern bool changes_neighborhood;
  extern bool changes_hna;
  extern bool changes_force;
+extern bool pending_change;

  extern union olsr_ip_addr all_zero;

diff --git a/src/olsr_spf.c b/src/olsr_spf.c
index 14fbf6d..224502c 100644
--- a/src/olsr_spf.c
+++ b/src/olsr_spf.c
@@ -306,6 +306,13 @@ static void
  olsr_expire_spf_backoff(void *context __attribute__ ((unused)))
  {
    spf_backoff_timer = NULL;
+
+  // if there has been a request to recalculate the routing tables 
while the
+  // backoff timer was on, trigger a routing update now
+  if (pending_change){
+      changes_force=true;
+      pending_change=false;
+  }
  }

  void
@@ -327,6 +334,7 @@ olsr_calculate_routing_table(bool force)
    /* We are done if our backoff timer is running */
    if (!force) {
      if (spf_backoff_timer) {
+      pending_change=true;
        return;
      }



-- 
Giovanni Di Stasi, Ph.D.
Dipartimento di Informatica e Sistemistica
Universita' degli Studi di Napoli "Federico II"
Via Claudio, 21 - 80125 Napoli - Italy

Phone: +39 081 7683821
Cell: +39 333 6383732
E-mail: (spam-protected)
Skype-ID: gdistasi





More information about the Olsr-dev mailing list