Process LQ_TC messages. Made link quality features configurable. Set
authorThomas Lopatic <thomas@lopatic.de>
Sun, 7 Nov 2004 20:09:12 +0000 (20:09 +0000)
committerThomas Lopatic <thomas@lopatic.de>
Sun, 7 Nov 2004 20:09:12 +0000 (20:09 +0000)
"LinkQualityLevel" to 1 to select MPRs based on the link quality. Set
this parameter to 2 to also calculate the routing table base on the
link qualities. 0 disables link quality usage. Added feature matrix.

17 files changed:
features.txt [new file with mode: 0644]
src/cfgparser/olsrd_conf.c
src/cfgparser/oparse.y
src/cfgparser/oscan.lex
src/link_set.c
src/lq_mpr.c
src/lq_packet.c
src/lq_packet.h
src/olsr.c
src/olsr_cfg.h
src/olsr_protocol.h
src/packet.h
src/parser.c
src/process_package.c
src/tc_set.c
src/unix/ifnet.c
src/win32/ifnet.c

diff --git a/features.txt b/features.txt
new file mode 100644 (file)
index 0000000..88a5e81
--- /dev/null
@@ -0,0 +1,41 @@
+Features supported by the different versions of olsrd.
+
+    X   supported
+    !   support planned
+    -   support not planned
+    ?   unsure
+
+                                   Linux  Windows  FreeBSD  OSX
+
+IPv6                                 X       !        !      !
+
+automatically enable IP              X       X        !      !
+forwarding
+
+automatically disable ICMP           X       !        !      !
+redirect messages
+
+automatically disable                X       ?        ?      ?
+anti-spoofing
+
+use 255.255.255.255 as broadcast     X       ?        !      !
+address on a single interface
+
+use 255.255.255.255 as broadcast     X       ?        !      !
+address on multiple interfaces
+
+use the same subnet broadcast        X       -        -      -
+address on multiple interfaces
+
+initially delete default routes      X       !        !      !
+
+recognize WLAN interfaces            X       X        !      !
+
+willingness based on                 X       X        ?      ?
+battery power
+
+gateway tunneling                    X       -        -      -
+
+TOS                                  X       -        -      -
+
+link layer information               X       -        -      -
index 83024d6..482b04e 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: olsrd_conf.c,v 1.13 2004/11/05 11:52:56 kattemat Exp $
+ * $Id: olsrd_conf.c,v 1.14 2004/11/07 20:09:12 tlopatic Exp $
  *
  */
 
@@ -262,6 +262,7 @@ set_default_cnf(struct olsrd_config *cnf)
 
     cnf->tc_redundancy = TC_REDUNDANCY;
     cnf->mpr_coverage = MPR_COVERAGE;
+    cnf->lq_level = LQ_LEVEL;
 }
 
 
@@ -422,8 +423,10 @@ olsrd_write_cnf(struct olsrd_config *cnf, char *fname)
   fprintf(fd, "# MPR coverage\n# Specifies how many MPRs a node should\n# try select to reach every 2 hop neighbor\n# Can be set to any integer >0\n# defaults to 1\n\n");
 
   fprintf(fd, "MprCoverage\t%d\n\n", cnf->mpr_coverage);
-   
 
+  fprintf(fd, "# Link quality level\n# 0 = do not use link quality\n# 1 = use link quality for MPR selection\n# 2 = use link quality for MPR selection and routing\n\n");
+   
+  fprintf(fd, "LinkQualityLevel\t%d\n\n", cnf->lq_level);
 
   /* Plugins */
   fprintf(fd, "# Olsrd plugins to load\n# This must be the absolute path to the file\n# or the loader will use the following scheme:\n# - Try the paths in the LD_LIBRARY_PATH \n#   environment variable.\n# - The list of libraries cached in /etc/ld.so.cache\n# - /lib, followed by /usr/lib\n\n");
@@ -575,6 +578,8 @@ olsrd_print_cnf(struct olsrd_config *cnf)
 
   printf("MPR coverage     : %d\n", cnf->mpr_coverage);
    
+  printf("LQ level         : %d\n", cnf->lq_level);
+
   /* Interfaces */
   if(in)
     {
index 239011c..d220d81 100644 (file)
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: oparse.y,v 1.13 2004/11/06 00:08:26 kattemat Exp $
+ * $Id: oparse.y,v 1.14 2004/11/07 20:09:12 tlopatic Exp $
  *
  */
 
@@ -78,6 +78,7 @@ int yylex(void);
 %token TOK_POLLRATE
 %token TOK_TCREDUNDANCY
 %token TOK_MPRCOVERAGE
+%token TOK_LQ_LEVEL
 %token TOK_PLNAME
 %token TOK_PLPARAM
 
@@ -119,6 +120,7 @@ stmt:       idebug
           | fpollrate
           | atcredundancy
           | amprcoverage
+          | alq_level
           | vcomment
 ;
 
@@ -558,6 +560,14 @@ amprcoverage: TOK_MPRCOVERAGE TOK_INTEGER
 }
 ;
 
+alq_level: TOK_LQ_LEVEL TOK_INTEGER
+{
+  if(PARSER_DEBUG) printf("Link quality level %d\n", $2->integer);
+  cnf->lq_level = $2->integer;
+
+  free($2);
+}
+;
 
 plblock: TOK_PLUGIN TOK_STRING
 {
index 0baed59..fbd8b65 100644 (file)
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: oscan.lex,v 1.8 2004/11/05 11:52:57 kattemat Exp $
+ * $Id: oscan.lex,v 1.9 2004/11/07 20:09:12 tlopatic Exp $
  *
  */
 
@@ -327,6 +327,11 @@ IPV6ADDR {IP6PAT1}|{IP6PAT2}|{IP6PAT3}|{IP6PAT4}|{IP6PAT5}|{IP6PAT6}|{IP6PAT7}|{
   return TOK_MPRCOVERAGE;
 }
 
+"LinkQualityLevel" {
+  yylval = NULL;
+  return TOK_LQ_LEVEL;
+}
+
 "Ip4Broadcast" {
   yylval = NULL;
   return TOK_IP4BROADCAST;
index 5158f28..d234038 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: link_set.c,v 1.18 2004/11/07 17:51:20 tlopatic Exp $
+ * $Id: link_set.c,v 1.19 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -81,7 +81,7 @@ olsr_init_link_set()
     }
 
 #if defined USE_LINK_QUALITY
-  if (1)
+  if (olsr_cnf->lq_level > 0)
     {
       olsr_register_timeout_function(&olsr_time_out_packet_loss);
     }
@@ -335,32 +335,46 @@ get_interface_link_set(union olsr_ip_addr *remote)
          /* Must be symmetric link! */
          if(!TIMED_OUT(&tmp_link_set->SYM_time))
            {
-#if !defined USE_LINK_QUALITY
-             if (if_to_use == NULL || if_to_use->int_metric > tmp_if->int_metric)
-          if_to_use = tmp_if;
-#else
-        if (if_to_use == NULL ||
-            tmp_link_set->loss_link_quality > link_quality)
+#if defined USE_LINK_QUALITY
+        if (olsr_cnf->lq_level == 0)
+          {
+#endif
+            if (if_to_use == NULL || if_to_use->int_metric > tmp_if->int_metric)
+              if_to_use = tmp_if;
+#if defined USE_LINK_QUALITY
+          }
+
+        else if (if_to_use == NULL ||
+                 tmp_link_set->neigh_link_quality *
+                 tmp_link_set->loss_link_quality > link_quality)
           {
             if_to_use = tmp_if;
-            link_quality = tmp_link_set->loss_link_quality;
+            link_quality = tmp_link_set->neigh_link_quality *
+              tmp_link_set->loss_link_quality;
           }
 #endif
            }
          /* Backup solution in case the links have timed out */
          else
            {
-#if !defined USE_LINK_QUALITY
-             if (if_to_use == NULL &&
-            (backup_if == NULL || backup_if->int_metric > tmp_if->int_metric))
-          backup_if = tmp_if;
-#else
-        if (if_to_use == NULL &&
-            (backup_if == NULL ||
-             tmp_link_set->loss_link_quality > backup_link_quality))
+#if defined USE_LINK_QUALITY
+        if (olsr_cnf->lq_level == 0)
+          {
+#endif
+            if (if_to_use == NULL &&
+                (backup_if == NULL || backup_if->int_metric > tmp_if->int_metric))
+              backup_if = tmp_if;
+#if defined USE_LINK_QUALITY
+          }
+
+        else if (if_to_use == NULL &&
+                 (backup_if == NULL ||
+                  tmp_link_set->neigh_link_quality *
+                  tmp_link_set->loss_link_quality > backup_link_quality))
           {
             backup_if = tmp_if;
-            backup_link_quality = tmp_link_set->loss_link_quality;
+            backup_link_quality = tmp_link_set->neigh_link_quality *
+              tmp_link_set->loss_link_quality;
           }
 #endif
            }
@@ -451,7 +465,7 @@ add_new_entry(union olsr_ip_addr *local, union olsr_ip_addr *remote, union olsr_
   new_link->L_link_quality = 0.0;
 
 #if defined USE_LINK_QUALITY
-  if (1)
+  if (olsr_cnf->lq_level > 0)
     {
       new_link->loss_hello_int = htime;
 
index b2052e2..326d570 100644 (file)
@@ -18,7 +18,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: lq_mpr.c,v 1.1 2004/11/05 20:58:10 tlopatic Exp $
+ * $Id: lq_mpr.c,v 1.2 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -35,6 +35,7 @@ void olsr_calculate_lq_mpr(void)
   int i;
   struct neighbor_entry *neigh;
   double best;
+  olsr_bool mpr_changes = OLSR_FALSE;
 
   for(i = 0; i < HASHSIZE; i++)
     {
@@ -59,7 +60,7 @@ void olsr_calculate_lq_mpr(void)
           neigh->is_mpr = OLSR_TRUE;
 
           if (neigh->is_mpr != neigh->was_mpr)
-            changes = OLSR_TRUE;
+            mpr_changes = OLSR_TRUE;
         }
     }
 
@@ -89,8 +90,11 @@ void olsr_calculate_lq_mpr(void)
           neigh->is_mpr = OLSR_TRUE;
 
           if (neigh->is_mpr != neigh->was_mpr)
-            changes = OLSR_TRUE;
+            mpr_changes = OLSR_TRUE;
         }
     }
+
+  if (mpr_changes && olsr_cnf->tc_redundancy > 0)
+    changes = OLSR_TRUE;
 }
 #endif
index e909c05..92550ac 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: lq_packet.c,v 1.3 2004/11/05 20:58:10 tlopatic Exp $
+ * $Id: lq_packet.c,v 1.4 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -129,6 +129,7 @@ create_lq_tc(struct lq_tc_message *lq_tc, struct interface *outif)
   struct lq_tc_neighbor *neigh;
   int i;
   struct neighbor_entry *walker;
+  struct link_entry *link;
 
   // initialize the static fields
 
@@ -182,8 +183,11 @@ create_lq_tc(struct lq_tc_message *lq_tc, struct interface *outif)
 
           // set the entry's link quality
 
-          neigh->link_quality =
-            olsr_neighbor_best_link_quality(&neigh->main);
+          link = olsr_neighbor_best_inverse_link(&neigh->main);
+          neigh->link_quality = link->loss_link_quality;
+
+          link = olsr_neighbor_best_link(&neigh->main);
+          neigh->neigh_link_quality = link->neigh_link_quality;
 
           // queue the neighbour entry
 
@@ -493,12 +497,12 @@ serialize_lq_tc(struct lq_tc_message *lq_tc, struct interface *outif)
       // add the corresponding link quality
 
       buff[size++] = (unsigned char)(neigh->link_quality * 256);
+      buff[size++] = (unsigned char)(neigh->neigh_link_quality * 256);
 
       // pad
 
       buff[size++] = 0;
       buff[size++] = 0;
-      buff[size++] = 0;
     }
 
   // finalize the OLSR header
@@ -649,8 +653,10 @@ deserialize_lq_tc(struct lq_tc_message *lq_tc, void *ser,
       COPY_IP(&neigh->main, curr);
       curr += ipsize;
 
-      neigh->link_quality = (double)*curr / 256.0;
-      curr += 4;
+      neigh->link_quality = (double)*curr++ / 256.0;
+      neigh->neigh_link_quality = (double)*curr++ / 256.0;
+
+      curr += 2;
 
       neigh->next = lq_tc->neigh;
       lq_tc->neigh = neigh;
@@ -813,6 +819,7 @@ process_lq_tc(struct lq_tc_message *lq_tc, struct interface *inif,
       // copy fields
 
       new_neigh->link_quality = neigh->link_quality;
+      new_neigh->neigh_link_quality = neigh->neigh_link_quality;
 
       COPY_IP(&new_neigh->address, &neigh->main);
 
index 6856da2..2efdd58 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: lq_packet.h,v 1.2 2004/11/05 20:58:10 tlopatic Exp $
+ * $Id: lq_packet.h,v 1.3 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -106,6 +106,7 @@ struct lq_hello_header
 struct lq_tc_neighbor
 {
   double                link_quality;
+  double                neigh_link_quality;
   union olsr_ip_addr    main;
   struct lq_tc_neighbor *next;
 };
index 032fca8..699cb06 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: olsr.c,v 1.18 2004/11/07 17:51:20 tlopatic Exp $
+ * $Id: olsr.c,v 1.19 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -167,13 +167,33 @@ olsr_process_changes()
   if(changes_neighborhood)
     {
       /* Calculate new mprs, HNA and routing table */
-#if !defined USE_LINK_QUALITY
-      olsr_calculate_mpr();
-      olsr_calculate_routing_table();
-#else
-      olsr_calculate_lq_mpr();
-      olsr_calculate_lq_routing_table();
+#if defined USE_LINK_QUALITY
+      if (olsr_cnf->lq_level < 1)
+        {
 #endif
+          olsr_calculate_mpr();
+#if defined USE_LINK_QUALITY
+        }
+
+      else
+        {
+          olsr_calculate_lq_mpr();
+        }
+
+
+      if (olsr_cnf->lq_level < 2)
+        {
+#endif
+          olsr_calculate_routing_table();
+#if defined USE_LINK_QUALITY
+        }
+
+      else
+        {
+          olsr_calculate_lq_routing_table();
+        }
+#endif
+
       olsr_calculate_hna_routes();
 
       goto process_pcf;  
@@ -182,10 +202,18 @@ olsr_process_changes()
   if(changes_topology)
     {
       /* calculate the routing table and HNA */
-#if !defined USE_LINK_QUALITY
-      olsr_calculate_routing_table();
-#else
-      olsr_calculate_lq_routing_table();
+#if defined USE_LINK_QUALITY
+      if (olsr_cnf->lq_level < 2)
+        {
+#endif
+          olsr_calculate_routing_table();
+#if defined USE_LINK_QUALITY
+        }
+
+      else
+        {
+          olsr_calculate_lq_routing_table();
+        }
 #endif
       olsr_calculate_hna_routes();
 
index 81470d2..e3c9bc5 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: olsr_cfg.h,v 1.5 2004/11/05 11:52:56 kattemat Exp $
+ * $Id: olsr_cfg.h,v 1.6 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -154,6 +154,7 @@ struct olsrd_config
   float                    pollrate;
   olsr_u8_t                tc_redundancy;
   olsr_u8_t                mpr_coverage;
+  olsr_u8_t                lq_level;
   struct plugin_entry      *plugins;
   struct hna4_entry        *hna4_entries;
   struct hna6_entry        *hna6_entries;
index e911243..0646cf9 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: olsr_protocol.h,v 1.11 2004/11/05 14:33:31 tlopatic Exp $
+ * $Id: olsr_protocol.h,v 1.12 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -193,6 +193,12 @@ union olsr_ip_addr
 #define TC_REDUNDANCY         0
 #define MPR_COVERAGE          1
 
+/*
+ * link quality defaults
+ */
+
+#define LQ_LEVEL              0
+
 /*
  *Misc. Constants
  */
index 13334a0..3ea197c 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: packet.h,v 1.9 2004/11/05 20:58:10 tlopatic Exp $
+ * $Id: packet.h,v 1.10 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -69,6 +69,7 @@ struct tc_mpr_addr
 {
 #if defined USE_LINK_QUALITY
   double             link_quality;
+  double             neigh_link_quality;
 #endif
   union olsr_ip_addr address;
   struct tc_mpr_addr *next;
index 5047086..ea0d28c 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: parser.c,v 1.11 2004/11/03 18:19:54 tlopatic Exp $
+ * $Id: parser.c,v 1.12 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -306,7 +306,7 @@ parse_packet(struct olsr *olsr, int size, struct interface *in_if, union olsr_ip
     }
 
 #if defined USE_LINK_QUALITY
-  if (1)
+  if (olsr_cnf->lq_level > 0)
     {
       olsr_update_packet_loss(from_addr, &in_if->ip_addr,
                               ntohs(olsr->olsr_seqno));
index 25e309f..48168d7 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: process_package.c,v 1.15 2004/11/07 18:48:54 kattemat Exp $
+ * $Id: process_package.c,v 1.16 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
 void
 olsr_init_package_process()
 {
-#if !defined USE_LINK_QUALITY
-  olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1);
-  olsr_parser_add_function(&olsr_process_received_tc, TC_MESSAGE, 1);
-#else
-  olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1);
-  olsr_parser_add_function(&olsr_input_lq_tc, LQ_TC_MESSAGE, 1);
+#if defined USE_LINK_QUALITY
+  if (olsr_cnf->lq_level == 0)
+    {
+#endif
+      olsr_parser_add_function(&olsr_process_received_hello, HELLO_MESSAGE, 1);
+      olsr_parser_add_function(&olsr_process_received_tc, TC_MESSAGE, 1);
+#if defined USE_LINK_QUALITY
+    }
+
+  else
+    {
+      olsr_parser_add_function(&olsr_input_lq_hello, LQ_HELLO_MESSAGE, 1);
+      olsr_parser_add_function(&olsr_input_lq_tc, LQ_TC_MESSAGE, 1);
+    }
 #endif
   olsr_parser_add_function(&olsr_process_received_mid, MID_MESSAGE, 1);
   olsr_parser_add_function(&olsr_process_received_hna, HNA_MESSAGE, 1);
@@ -74,24 +82,27 @@ olsr_hello_tap(struct hello_message *message, struct interface *in_if,
   link = update_link_entry(&in_if->ip_addr, from_addr, message, in_if);
 
 #if defined USE_LINK_QUALITY
-  // just in case our neighbor has changed its HELLO interval
+  if (olsr_cnf->lq_level > 0)
+    {
+      // just in case our neighbor has changed its HELLO interval
 
-  olsr_update_packet_loss_hello_int(link, message->htime);
+      olsr_update_packet_loss_hello_int(link, message->htime);
 
-  // find the input interface in the list of neighbor interfaces
+      // find the input interface in the list of neighbor interfaces
 
-  for (walker = message->neighbors; walker != NULL; walker = walker->next)
-    if (COMP_IP(&walker->address, &in_if->ip_addr))
-      break;
+      for (walker = message->neighbors; walker != NULL; walker = walker->next)
+        if (COMP_IP(&walker->address, &in_if->ip_addr))
+          break;
 
-  // memorize our neighbour's idea of the link quality, so that we
-  // know the link quality in both directions
+      // memorize our neighbour's idea of the link quality, so that we
+      // know the link quality in both directions
 
-  if (walker != NULL)
-    link->neigh_link_quality = walker->link_quality;
+      if (walker != NULL)
+        link->neigh_link_quality = walker->link_quality;
 
-  else
-    link->neigh_link_quality = 0.0;
+      else
+        link->neigh_link_quality = 0.0;
+    }
 #endif
   
   neighbor = link->neighbor;
@@ -482,11 +493,9 @@ olsr_process_message_neighbors(struct neighbor_entry *neighbor,
   struct neighbor_2_list_entry *two_hop_neighbor_yet;
   struct neighbor_2_entry      *two_hop_neighbor;
   union olsr_ip_addr           *neigh_addr;
-
 #if defined USE_LINK_QUALITY
   struct neighbor_list_entry *walker;
-  double link_quality =
-    olsr_neighbor_best_link_quality(&neighbor->neighbor_main_addr);
+  double link_quality;
 #endif
 
   for(message_neighbors = message->neighbors;
@@ -571,26 +580,32 @@ olsr_process_message_neighbors(struct neighbor_entry *neighbor,
                 }
             }
 #if defined USE_LINK_QUALITY
-          // loop through the one-hop neighbors that see this
-          // two hop neighbour
-
-          for (walker = two_hop_neighbor->neighbor_2_nblist.next;
-               walker != &two_hop_neighbor->neighbor_2_nblist;
-               walker = walker->next)
+          if (olsr_cnf->lq_level > 0)
             {
-              // have we found the one-hop neighbor that sent the
-              // HELLO message that we're current processing?
+              link_quality =
+                olsr_neighbor_best_link_quality(&neighbor->neighbor_main_addr);
+
+              // loop through the one-hop neighbors that see this
+              // two hop neighbour
 
-              if (walker->neighbor == neighbor)
+              for (walker = two_hop_neighbor->neighbor_2_nblist.next;
+                   walker != &two_hop_neighbor->neighbor_2_nblist;
+                   walker = walker->next)
                 {
-                  // total link quality = link quality between us
-                  // and our one-hop neighbor x link quality between
-                  // our one-hop neighbor and the two-hop neighbor
-
-                  walker->full_link_quality =
-                    link_quality *
-                    message_neighbors->link_quality *
-                    message_neighbors->neigh_link_quality;
+                  // have we found the one-hop neighbor that sent the
+                  // HELLO message that we're current processing?
+
+                  if (walker->neighbor == neighbor)
+                    {
+                      // total link quality = link quality between us
+                      // and our one-hop neighbor x link quality between
+                      // our one-hop neighbor and the two-hop neighbor
+
+                      walker->full_link_quality =
+                        link_quality *
+                        message_neighbors->link_quality *
+                        message_neighbors->neigh_link_quality;
+                    }
                 }
             }
 #endif
index 2d939a1..7d280d3 100644 (file)
@@ -19,7 +19,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: tc_set.c,v 1.8 2004/11/05 11:52:56 kattemat Exp $
+ * $Id: tc_set.c,v 1.9 2004/11/07 20:09:11 tlopatic Exp $
  *
  */
 
@@ -241,6 +241,15 @@ olsr_tc_update_mprs(struct tc_entry *entry, struct tc_message *msg)
          COPY_IP(&new_topo_dst->T_dest_addr, &mprs->address);
          olsr_get_timestamp((olsr_u32_t) msg->vtime*1000, &new_topo_dst->T_time);
          new_topo_dst->T_seq = msg->ansn;
+
+#if defined USE_LINK_QUALITY
+    if (olsr_cnf->lq_level > 0)
+      {
+        new_topo_dst->link_quality = mprs->neigh_link_quality;
+        new_topo_dst->inverse_link_quality = mprs->link_quality;
+      }
+#endif
+
          /* Add to queue */
          new_topo_dst->prev = &entry->destinations;
          new_topo_dst->next = entry->destinations.next;
index cb4bf01..aa7d3c8 100644 (file)
@@ -20,7 +20,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * 
  * 
- * $Id: ifnet.c,v 1.3 2004/11/05 14:33:31 tlopatic Exp $
+ * $Id: ifnet.c,v 1.4 2004/11/07 20:09:12 tlopatic Exp $
  *
  */
 
@@ -440,28 +440,36 @@ chk_if_changed(struct olsr_if *iface)
   /*
    * Deregister scheduled functions 
    */
-#if !defined USE_LINK_QUALITY
-  olsr_remove_scheduler_event(&generate_hello, 
-                             ifp, 
-                             iface->cnf->hello_params.emission_interval, 
-                             0, 
-                             NULL);
-  olsr_remove_scheduler_event(&generate_tc, 
-                             ifp, 
-                             iface->cnf->tc_params.emission_interval,
-                             0, 
-                             NULL);
-#else
-  olsr_remove_scheduler_event(&olsr_output_lq_hello, 
-                             ifp, 
-                             iface->cnf->hello_params.emission_interval, 
-                             0, 
-                             NULL);
-  olsr_remove_scheduler_event(&olsr_output_lq_tc, 
-                             ifp, 
-                             iface->cnf->tc_params.emission_interval,
-                             0, 
-                             NULL);
+#if defined USE_LINK_QUALITY
+  if (olsr_cnf->lq_level == 0)
+    {
+#endif
+      olsr_remove_scheduler_event(&generate_hello, 
+                                  ifp, 
+                                  iface->cnf->hello_params.emission_interval, 
+                                  0, 
+                                  NULL);
+      olsr_remove_scheduler_event(&generate_tc, 
+                                  ifp, 
+                                  iface->cnf->tc_params.emission_interval,
+                                  0, 
+                                  NULL);
+#if defined USE_LINK_QUALITY
+    }
+
+  else
+    {
+      olsr_remove_scheduler_event(&olsr_output_lq_hello, 
+                                  ifp, 
+                                  iface->cnf->hello_params.emission_interval, 
+                                  0, 
+                                  NULL);
+      olsr_remove_scheduler_event(&olsr_output_lq_tc, 
+                                  ifp, 
+                                  iface->cnf->tc_params.emission_interval,
+                                  0, 
+                                  NULL);
+    }
 #endif
   olsr_remove_scheduler_event(&generate_mid, 
                              ifp, 
@@ -781,28 +789,36 @@ chk_if_up(struct olsr_if *iface, int debuglvl)
   /*
    * Register scheduled functions 
    */
-#if !defined USE_LINK_QUALITY
-  olsr_register_scheduler_event(&generate_hello, 
-                               ifp, 
-                               iface->cnf->hello_params.emission_interval, 
-                               0, 
-                               NULL);
-  olsr_register_scheduler_event(&generate_tc, 
-                               ifp, 
-                               iface->cnf->tc_params.emission_interval,
-                               0, 
-                               NULL);
-#else
-  olsr_register_scheduler_event(&olsr_output_lq_hello, 
-                               ifp, 
-                               iface->cnf->hello_params.emission_interval, 
-                               0, 
-                               NULL);
-  olsr_register_scheduler_event(&olsr_output_lq_tc, 
-                               ifp, 
-                               iface->cnf->tc_params.emission_interval,
-                               0, 
-                               NULL);
+#if defined USE_LINK_QUALITY
+  if (olsr_cnf->lq_level == 0)
+    {
+#endif
+      olsr_register_scheduler_event(&generate_hello, 
+                                    ifp, 
+                                    iface->cnf->hello_params.emission_interval, 
+                                    0, 
+                                    NULL);
+      olsr_register_scheduler_event(&generate_tc, 
+                                    ifp, 
+                                    iface->cnf->tc_params.emission_interval,
+                                    0, 
+                                    NULL);
+#if defined USE_LINK_QUALITY
+    }
+
+  else
+    {
+      olsr_register_scheduler_event(&olsr_output_lq_hello, 
+                                    ifp, 
+                                    iface->cnf->hello_params.emission_interval, 
+                                    0, 
+                                    NULL);
+      olsr_register_scheduler_event(&olsr_output_lq_tc, 
+                                    ifp, 
+                                    iface->cnf->tc_params.emission_interval,
+                                    0, 
+                                    NULL);
+    }
 #endif
   olsr_register_scheduler_event(&generate_mid, 
                                ifp, 
index dbf6129..e23004c 100644 (file)
@@ -21,7 +21,7 @@
  * along with olsr.org; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * $Id: ifnet.c,v 1.9 2004/11/05 14:33:31 tlopatic Exp $
+ * $Id: ifnet.c,v 1.10 2004/11/07 20:09:12 tlopatic Exp $
  *
  */
 
@@ -513,22 +513,30 @@ void RemoveInterface(struct olsr_if *IntConf)
     }
   }
 
-#if !defined USE_LINK_QUALITY
-  olsr_remove_scheduler_event(&generate_hello, Int,
-                              IntConf->cnf->hello_params.emission_interval,
-                              0, NULL);
+#if defined USE_LINK_QUALITY
+  if (olsr_cnf->lq_level == 0)
+    {
+#endif
+      olsr_remove_scheduler_event(&generate_hello, Int,
+                                  IntConf->cnf->hello_params.emission_interval,
+                                  0, NULL);
+
+      olsr_remove_scheduler_event(&generate_tc, Int,
+                                  IntConf->cnf->tc_params.emission_interval,
+                                  0, NULL);
+#if defined USE_LINK_QUALITY
+    }
 
-  olsr_remove_scheduler_event(&generate_tc, Int,
-                              IntConf->cnf->tc_params.emission_interval,
-                              0, NULL);
-#else
-  olsr_remove_scheduler_event(&olsr_output_lq_hello, Int,
-                              IntConf->cnf->hello_params.emission_interval,
-                              0, NULL);
+  else
+    {
+      olsr_remove_scheduler_event(&olsr_output_lq_hello, Int,
+                                  IntConf->cnf->hello_params.emission_interval,
+                                  0, NULL);
 
-  olsr_remove_scheduler_event(&olsr_output_lq_tc, Int,
-                              IntConf->cnf->tc_params.emission_interval,
-                              0, NULL);
+      olsr_remove_scheduler_event(&olsr_output_lq_tc, Int,
+                                  IntConf->cnf->tc_params.emission_interval,
+                                  0, NULL);
+    }
 #endif
   olsr_remove_scheduler_event(&generate_mid, Int,
                               IntConf->cnf->mid_params.emission_interval,
@@ -799,22 +807,30 @@ int chk_if_up(struct olsr_if *IntConf, int DebugLevel)
 
   net_add_buffer(New);
 
-#if !defined USE_LINK_QUALITY
-  olsr_register_scheduler_event(&generate_hello, New,
-                                IntConf->cnf->hello_params.emission_interval,
-                                0, NULL);
+#if defined USE_LINK_QUALITY
+  if (olsr_cnf->lq_level == 0)
+    {
+#endif
+      olsr_register_scheduler_event(&generate_hello, New,
+                                    IntConf->cnf->hello_params.emission_interval,
+                                    0, NULL);
+
+      olsr_register_scheduler_event(&generate_tc, New,
+                                    IntConf->cnf->tc_params.emission_interval,
+                                    0, NULL);
+#if defined USE_LINK_QUALITY
+    }
 
-  olsr_register_scheduler_event(&generate_tc, New,
-                                IntConf->cnf->tc_params.emission_interval,
-                                0, NULL);
-#else
-  olsr_register_scheduler_event(&olsr_output_lq_hello, New,
-                                IntConf->cnf->hello_params.emission_interval,
-                                0, NULL);
+  else
+    {
+      olsr_register_scheduler_event(&olsr_output_lq_hello, New,
+                                    IntConf->cnf->hello_params.emission_interval,
+                                    0, NULL);
 
-  olsr_register_scheduler_event(&olsr_output_lq_tc, New,
-                                IntConf->cnf->tc_params.emission_interval,
-                                0, NULL);
+      olsr_register_scheduler_event(&olsr_output_lq_tc, New,
+                                    IntConf->cnf->tc_params.emission_interval,
+                                    0, NULL);
+    }
 #endif
   olsr_register_scheduler_event(&generate_mid, New,
                                 IntConf->cnf->mid_params.emission_interval,