[Olsr-cvs] olsrd-current/src lq_route.c, 1.52, 1.53 routing_table.c, 1.31, 1.32 routing_table.h, 1.22, 1.23 tc_set.c, 1.30, 1.31 tc_set.h, 1.17, 1.18

Bernd Petrovitsch (spam-protected)
Tue Oct 16 11:54:48 CEST 2007


Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12884/src

Modified Files:
	lq_route.c routing_table.c routing_table.h tc_set.c tc_set.h 
Log Message:
* applied http://gredler.at/download/olsrd/neighbor_routes3.diff

Index: tc_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** tc_set.h	13 Sep 2007 22:43:15 -0000	1.17
--- tc_set.h	16 Oct 2007 09:54:44 -0000	1.18
***************
*** 1,5 ****
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * LSDB rewrite (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
--- 1,5 ----
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * LSDB rewrite (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
***************
*** 117,120 ****
--- 117,121 ----
  
  int olsr_init_tc(void);
+ void olsr_change_myself_tc(void);
  int olsr_tc_delete_mprs(struct tc_entry *, struct tc_message *);
  int olsr_tc_update_mprs(struct tc_entry *, struct tc_message *);

Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** lq_route.c	16 Sep 2007 21:20:07 -0000	1.52
--- lq_route.c	16 Oct 2007 09:54:43 -0000	1.53
***************
*** 338,341 ****
--- 338,342 ----
     * zero ourselves and add us to the candidate tree.
     */
+   olsr_change_myself_tc();
    tc_myself->path_etx = ZERO_ETX;
    olsr_spf_add_cand_tree(&cand_tree, tc_myself);
***************
*** 402,407 ****
  #endif
  
-   olsr_fill_routing_table_with_neighbors();
- 
    /*
     * In the path tree we have all the reachable nodes in our topology.
--- 403,406 ----

Index: tc_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** tc_set.c	17 Sep 2007 22:24:22 -0000	1.30
--- tc_set.c	16 Oct 2007 09:54:43 -0000	1.31
***************
*** 1,5 ****
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * LSDB rewrite (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
--- 1,5 ----
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * LSDB rewrite (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
***************
*** 73,76 ****
--- 73,109 ----
  
  /**
+  * The main ip address has changed.
+  * Do the needful.
+  */
+ void
+ olsr_change_myself_tc(void)
+ {
+   struct tc_edge_entry *tc_edge;
+ 
+   if (tc_myself) {
+ 
+     /*
+      * Check if there was a change.
+      */
+     if (COMP_IP(&tc_myself->addr, &olsr_cnf->main_addr)) {
+       return;
+     }
+ 
+     /*
+      * Flush all edges. This causes our own tc_entry to vanish.
+      */
+     OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc_myself, tc_edge) {
+       olsr_delete_tc_edge_entry(tc_edge);
+     } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc_myself, tc_edge);
+   }
+ 
+   /*
+    * The old entry for ourselves is gone, generate a new one and trigger SPF.
+    */
+   tc_myself = olsr_add_tc_entry(&olsr_cnf->main_addr);
+   changes_topology = OLSR_TRUE;
+ }
+ 
+ /**
   * Delete a TC entry.
   *
***************
*** 396,400 ****
         * If the edge gets refreshed in subsequent packets then we have
         * avoided a two edge transistion.
!        * If the edge really went away then after the garbace collection
         * timer has expired olsr_time_out_tc_set() will do the needful.
         */
--- 429,433 ----
         * If the edge gets refreshed in subsequent packets then we have
         * avoided a two edge transistion.
!        * If the edge really went away then after the garbage collection
         * timer has expired olsr_time_out_tc_set() will do the needful.
         */

Index: routing_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** routing_table.c	16 Sep 2007 21:20:17 -0000	1.31
--- routing_table.c	16 Oct 2007 09:54:43 -0000	1.32
***************
*** 1,5 ****
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * RIB implementation (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
--- 1,5 ----
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * RIB implementation (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
***************
*** 508,586 ****
  
  /**
-  *Insert all the one hop neighbors in the routing table.
-  *
-  *@return
-  */
- int
- olsr_fill_routing_table_with_neighbors(void)
- {
-   int index;
-   float etx;
- 
- #ifdef DEBUG
-   OLSR_PRINTF(7, "FILL ROUTING TABLE WITH NEIGHBORS\n");
- #endif
- 
-   for (index=0;index<HASHSIZE;index++) {
- 
-     struct neighbor_entry *neighbor;
- 
-     for(neighbor = neighbortable[index].next;
-         neighbor != &neighbortable[index];
-         neighbor=neighbor->next) {
- 
-       if (neighbor->status == SYM) {
- 
-         static struct mid_address addrs;
-         struct mid_address *addrs2;
- 
-         /*
-          * Insert all the neighbors addresses
-          */
-         COPY_IP(&addrs.alias, &neighbor->neighbor_main_addr);
-         addrs.next_alias = mid_lookup_aliases(&neighbor->neighbor_main_addr);
- 
-         for (addrs2 = &addrs; addrs2; addrs2 = addrs2->next_alias) {
- 
-           struct link_entry *link;
- 
-           link = get_best_link_to_neighbor(&addrs2->alias);
- 
- #ifdef DEBUG
-           OLSR_PRINTF(7, "(ROUTE)Adding neighbor %s\n", olsr_ip_to_string(&addrs.alias));
- #endif
-           if (link) {
- 
-             struct interface *iface;
- 
-             iface = link->if_name ? if_ifwithname(link->if_name) :
-               if_ifwithaddr(&link->local_iface_addr);
- 
-             etx = 1.0 / (link->loss_link_quality2 * link->neigh_link_quality2);
- 
-             if (iface) {
- 
-               /* neighbor main IP address */
-               olsr_insert_routing_table(&link->neighbor_iface_addr, olsr_cnf->maxplen,
-                                         &link->neighbor->neighbor_main_addr,
-                                         &link->neighbor_iface_addr,
-                                         iface->if_index, 1, etx);
- 
-               /* this is the nexthop route that all routes will be tracking */
-               olsr_insert_routing_table(&addrs2->alias, olsr_cnf->maxplen,
-                                         &link->neighbor->neighbor_main_addr,
-                                         &link->neighbor_iface_addr,
-                                         iface->if_index, 1, etx);
-             }
-           }
-         }
-       }
-     }
-   }
-   return 1;
- }
- 
- 
- /**
   *Calculate the HNA routes
   *
--- 508,511 ----

Index: routing_table.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** routing_table.h	16 Sep 2007 21:20:17 -0000	1.22
--- routing_table.h	16 Oct 2007 09:54:43 -0000	1.23
***************
*** 1,5 ****
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * RIB implementation (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
--- 1,5 ----
  /*
   * The olsr.org Optimized Link-State Routing daemon(olsrd)
!  * Copyright (c) 2004, Andreas Tønnesen((spam-protected))
   * RIB implementation (c) 2007, Hannes Gredler ((spam-protected))
   * All rights reserved.
***************
*** 158,162 ****
  
  void olsr_calculate_hna_routes(void);
- int olsr_fill_routing_table_with_neighbors(void);
  char *olsr_rt_to_string(struct rt_entry *);
  char *olsr_rtp_to_string(struct rt_path *);
--- 158,161 ----





More information about the Olsr-cvs mailing list