add cumulative etx for each destination to the routing table (struct rt_entry).
authorBruno Randolf <br1@einfach.org>
Wed, 20 Apr 2005 17:52:12 +0000 (17:52 +0000)
committerBruno Randolf <br1@einfach.org>
Wed, 20 Apr 2005 17:52:12 +0000 (17:52 +0000)
output it in the httpinfo plugin "routes" page

lib/httpinfo/src/olsrd_httpinfo.c
src/lq_route.c
src/routing_table.c
src/routing_table.h

index 0bdf9e7..5a01c0d 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: olsrd_httpinfo.c,v 1.51 2005/03/31 17:18:47 kattemat Exp $
+ * $Id: olsrd_httpinfo.c,v 1.52 2005/04/20 17:52:11 br1 Exp $
  */
 
 /*
@@ -701,7 +701,7 @@ build_routes_body(char *buf, olsr_u32_t bufsize)
 
   size += sprintf(&buf[size], "<h2>OLSR routes in kernel</h2>\n");
 
-  size += sprintf(&buf[size], "<table width=\"100%%\" BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=center><tr><th>Destination</th><th>Gateway</th><th>Metric</th><th>Interface</th><th>Type</th></tr>\n");
+  size += sprintf(&buf[size], "<table width=\"100%%\" BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=center><tr><th>Destination</th><th>Gateway</th><th>Metric</th><th>ETX</th><th>Interface</th><th>Type</th></tr>\n");
 
   /* Neighbors */
   for(index = 0;index < HASHSIZE;index++)
@@ -710,10 +710,11 @@ build_routes_body(char *buf, olsr_u32_t bufsize)
          routes != &host_routes[index];
          routes = routes->next)
        {
-         size += sprintf(&buf[size], "<tr><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>HOST</td></tr>\n",
+         size += sprintf(&buf[size], "<tr><td>%s</td><td>%s</td><td>%d</td><td>%.2f</td><td>%s</td><td>HOST</td></tr>\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);
        }
     }
index fa5f378..0ef388f 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: lq_route.c,v 1.33 2005/03/02 21:14:54 tlopatic Exp $
+ * $Id: lq_route.c,v 1.34 2005/04/20 17:52:11 br1 Exp $
  */
 
 #include "defs.h"
@@ -531,7 +531,7 @@ void olsr_calculate_lq_routing_table(void)
 
         if (olsr_lookup_routing_table(&vert->addr) == NULL)
           olsr_insert_routing_table(&vert->addr, &link->neighbor_iface_addr,
-                                    inter, hops);
+                                    inter, hops, vert->path_etx);
 
         // route addition, case B - add routes to the remaining interfaces
         // of the destination node
@@ -540,7 +540,8 @@ void olsr_calculate_lq_routing_table(void)
              mid_walker = mid_walker->next_alias)
           if (olsr_lookup_routing_table(&mid_walker->alias) == NULL)
             olsr_insert_routing_table(&mid_walker->alias,
-                                      &link->neighbor_iface_addr, inter, hops);
+                                      &link->neighbor_iface_addr, inter, hops, 
+                                      vert->path_etx);
 
         // XXX - we used to use olsr_lookup_routing_table() only here, but
         //       this assumed that case A or case B had already happened for
@@ -554,7 +555,8 @@ void olsr_calculate_lq_routing_table(void)
 
         if (olsr_lookup_routing_table(&link->neighbor_iface_addr) == NULL)
           olsr_insert_routing_table(&link->neighbor_iface_addr,
-                                    &link->neighbor_iface_addr, inter, 1);
+                                    &link->neighbor_iface_addr, inter, 1,
+                                    vert->path_etx);
       }
     }
   }
@@ -616,6 +618,7 @@ void olsr_calculate_lq_routing_table(void)
 
       COPY_IP(&hna_rt->rt_router, &gw_rt->rt_router);
       hna_rt->rt_metric = gw_rt->rt_metric;
+      hna_rt->rt_etx = gw_rt->rt_etx;
       hna_rt->rt_if = gw_rt->rt_if;
 
       // we're not a host route
index 7fd349c..6801763 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: routing_table.c,v 1.19 2005/02/26 23:01:41 kattemat Exp $
+ * $Id: routing_table.c,v 1.20 2005/04/20 17:52:12 br1 Exp $
  */
 
 
@@ -172,7 +172,8 @@ struct rt_entry *
 olsr_insert_routing_table(union olsr_ip_addr *dst, 
                          union olsr_ip_addr *router, 
                          struct interface *iface, 
-                         int metric)
+                         int metric,
+                         float etx)
 {
   struct rt_entry *new_route_entry, *rt_list;
   olsr_u32_t       hash;
@@ -187,6 +188,8 @@ olsr_insert_routing_table(union olsr_ip_addr *dst,
   new_route_entry->rt_if = iface;
 
   new_route_entry->rt_metric = metric;
+  new_route_entry->rt_etx = etx;
+  
   if(COMP_IP(dst, router))
     /* Not GW */
     new_route_entry->rt_flags = (RTF_UP|RTF_HOST);
@@ -261,7 +264,8 @@ olsr_fill_routing_table_with_neighbors()
                          olsr_insert_routing_table(&addrs2->alias, 
                                                    &link->neighbor_iface_addr,
                                                    iface,
-                                                   1);
+                                                   1,
+                                                   0);
                        }
                    }
              
@@ -375,7 +379,8 @@ olsr_fill_routing_table_with_two_hop_neighbors()
                            olsr_insert_routing_table(&addrsp->alias, 
                                                      &link->neighbor_iface_addr,
                                                      iface,
-                                                     2);
+                                                     2,
+                                                     0);
                          
                          if(new_route_entry != NULL)
                            {
@@ -471,7 +476,8 @@ olsr_calculate_routing_table()
                            olsr_insert_routing_table(&tmp_addrsp->alias, 
                                                      &list_destination_n->destination->rt_router, 
                                                      list_destination_n->destination->rt_if,
-                                                     list_destination_n->destination->rt_metric+1);
+                                                     list_destination_n->destination->rt_metric+1,
+                                                     0);
                          if(destination_n_1->destination != NULL)
                            {
                              destination_n_1->next=list_destination_n_1;
index fd00407..f143f93 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: routing_table.h,v 1.14 2005/02/19 17:43:28 kattemat Exp $
+ * $Id: routing_table.h,v 1.15 2005/04/20 17:52:12 br1 Exp $
  */
 
 #ifndef _OLSR_ROUTING_TABLE
@@ -55,6 +55,7 @@ struct rt_entry
   union hna_netmask     rt_mask;
   olsr_u8_t            rt_flags; 
   olsr_u16_t           rt_metric;
+  float                 rt_etx;
   struct interface      *rt_if;
   struct rt_entry       *prev;
   struct rt_entry       *next;
@@ -108,7 +109,7 @@ void
 olsr_print_routing_table(struct rt_entry *);
 
 struct rt_entry *
-olsr_insert_routing_table(union olsr_ip_addr *, union olsr_ip_addr *, struct interface *, int);
+olsr_insert_routing_table(union olsr_ip_addr *, union olsr_ip_addr *, struct interface *, int, float);
 
 struct rt_entry *
 olsr_lookup_routing_table(union olsr_ip_addr *);