[Olsr-cvs] olsrd-current/src build_msg.c, 1.32, 1.33 hysteresis.c, 1.16, 1.17 hysteresis.h, 1.7, 1.8 link_set.c, 1.63, 1.64 link_set.h, 1.28, 1.29 lq_route.c, 1.41, 1.42 mid_set.c, 1.15, 1.16 parser.c, 1.30, 1.31 process_routes.c, 1.28, 1.29 routing_table.c, 1.23, 1.24

Bernd Petrovitsch (spam-protected)
Thu Dec 14 12:29:22 CET 2006


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

Modified Files:
	build_msg.c hysteresis.c hysteresis.h link_set.c link_set.h 
	lq_route.c mid_set.c parser.c process_routes.c routing_table.c 
Log Message:
* applied patches from Sebastian Hagen <(spam-protected)>

Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** lq_route.c	7 Jan 2006 08:16:20 -0000	1.41
--- lq_route.c	14 Dec 2006 11:29:20 -0000	1.42
***************
*** 563,568 ****
      {
        // find the interface for the found link
! 
!       inter = if_ifwithaddr(&link->local_iface_addr);
  
        // we may see NULL here if the interface is down, but we have
--- 563,568 ----
      {
        // find the interface for the found link
!       inter = link->if_name ? if_ifwithname(link->if_name) : 
!               if_ifwithaddr(&link->local_iface_addr);
  
        // we may see NULL here if the interface is down, but we have

Index: hysteresis.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** hysteresis.h	6 Mar 2005 19:33:35 -0000	1.7
--- hysteresis.h	14 Dec 2006 11:29:19 -0000	1.8
***************
*** 61,65 ****
  
  void
! update_hysteresis_incoming(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u16_t);
  
  #endif
--- 61,65 ----
  
  void
! update_hysteresis_incoming(union olsr_ip_addr *, struct interface *, olsr_u16_t);
  
  #endif

Index: mid_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mid_set.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** mid_set.c	29 May 2005 12:47:45 -0000	1.15
--- mid_set.c	14 Dec 2006 11:29:20 -0000	1.16
***************
*** 52,55 ****
--- 52,56 ----
  struct mid_address reverse_mid_set[HASHSIZE];
  
+ struct mid_entry *mid_lookup_entry_bymain(union olsr_ip_addr *adr);
  
  /**
***************
*** 205,208 ****
--- 206,212 ----
  {
    struct mid_address *adr;
+   struct neighbor_entry *ne_old, *ne_new;
+   struct mid_entry *me_old;
+   int ne_ref_rp_count;
  
    adr = olsr_malloc(sizeof(struct mid_address), "Insert MID alias");
***************
*** 214,217 ****
--- 218,243 ----
    adr->next_alias = NULL;
    
+   // If we have an entry for this alias in neighbortable, we better adjust it's
+   // main address, because otherwise a fatal inconsistency between
+   // neighbortable and link_set will be created by way of this mid entry.
+   ne_old = olsr_lookup_neighbor_table_alias(alias);
+   if (ne_old != NULL) {
+      OLSR_PRINTF(2, "Remote main address change detected. Mangling neighbortable to replace %s with %s.\n", olsr_ip_to_string(alias), olsr_ip_to_string(main_add));
+      olsr_delete_neighbor_table(alias);
+      ne_new = olsr_insert_neighbor_table(main_add);
+      // adjust pointers to neighbortable-entry in link_set
+      ne_ref_rp_count = replace_neighbor_link_set(ne_old, ne_new);
+      if (ne_ref_rp_count > 0)
+         OLSR_PRINTF(2, "Performed %d neighbortable-pointer replacements (%p -> %p) in link_set.\n", ne_ref_rp_count, ne_old, ne_new);
+      
+      me_old = mid_lookup_entry_bymain(alias);
+      if (me_old) {
+         // we knew aliases to the previous main address; better forget about
+         // them now.
+         OLSR_PRINTF(2, "I already have an mid entry mapping addresses to this alias address. Removing existing mid entry to preserve consistency of mid_set.\n");
+         mid_delete_node(me_old);
+      }
+   }
+   
    insert_mid_tuple(main_add, adr, vtime);
    
***************
*** 256,270 ****
  
  
! 
! 
! /*
!  *Find all aliases for an address.
!  *
!  *@param adr the main address to search for
   *
!  *@return a linked list of addresses structs
   */
! struct mid_address *
! mid_lookup_aliases(union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp_list;
--- 282,292 ----
  
  
! /* Find mid entry to an address.
!  * @param adr the main address to search for
   *
!  * @return a linked list of address structs
   */
! struct mid_entry *
! mid_lookup_entry_bymain(union olsr_ip_addr *adr)
  {
    struct mid_entry *tmp_list;
***************
*** 281,285 ****
      {
        if(COMP_IP(&tmp_list->main_addr, adr))
! 	return tmp_list->aliases;
      }
  
--- 303,307 ----
      {
        if(COMP_IP(&tmp_list->main_addr, adr))
! 	return tmp_list;
      }
  
***************
*** 289,292 ****
--- 311,329 ----
  
  
+ /*
+  *Find all aliases for an address.
+  *
+  *@param adr the main address to search for
+  *
+  *@return a linked list of addresses structs
+  */
+ inline struct mid_address *
+ mid_lookup_aliases(union olsr_ip_addr *adr)
+ {
+   struct mid_entry *tmp = mid_lookup_entry_bymain(adr);
+   return tmp ? tmp->aliases : NULL;
+ }
+ 
+ 
  /**
   *Update the timer for an entry

Index: hysteresis.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/hysteresis.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** hysteresis.c	27 Feb 2005 10:43:38 -0000	1.16
--- hysteresis.c	14 Dec 2006 11:29:19 -0000	1.17
***************
*** 163,167 ****
  
  void
! update_hysteresis_incoming(union olsr_ip_addr *remote, union olsr_ip_addr *local, olsr_u16_t seqno)
  {
    struct link_entry *link;
--- 163,167 ----
  
  void
! update_hysteresis_incoming(union olsr_ip_addr *remote, struct interface *local, olsr_u16_t seqno)
  {
    struct link_entry *link;

Index: process_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_routes.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** process_routes.c	1 Nov 2006 09:20:13 -0000	1.28
--- process_routes.c	14 Dec 2006 11:29:20 -0000	1.29
***************
*** 117,122 ****
  
  /**
!  *Create a list containing the entries in in_table
!  *that does not exist in from_table
   *
   *@param from_table the table to use
--- 117,122 ----
  
  /**
!  *Create a list containing the entries in from_table
!  *that do not exist in in_table
   *
   *@param from_table the table to use

Index: parser.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** parser.c	7 Jan 2006 08:16:20 -0000	1.30
--- parser.c	14 Dec 2006 11:29:20 -0000	1.31
***************
*** 202,206 ****
  	  /* IPv4 */
  	  update_hysteresis_incoming(from_addr, 
! 				     &in_if->ip_addr,
  				     ntohs(olsr->olsr_seqno));
  	}
--- 202,206 ----
  	  /* IPv4 */
  	  update_hysteresis_incoming(from_addr, 
! 				     in_if,
  				     ntohs(olsr->olsr_seqno));
  	}
***************
*** 209,213 ****
  	  /* IPv6 */
  	  update_hysteresis_incoming(from_addr, 
! 				     &in_if->ip_addr, 
  				     ntohs(olsr->olsr_seqno));
  	}
--- 209,213 ----
  	  /* IPv6 */
  	  update_hysteresis_incoming(from_addr, 
! 				     in_if, 
  				     ntohs(olsr->olsr_seqno));
  	}
***************
*** 216,220 ****
    if (olsr_cnf->lq_level > 0)
      {
!       olsr_update_packet_loss(from_addr, &in_if->ip_addr,
                                ntohs(olsr->olsr_seqno));
      }
--- 216,220 ----
    if (olsr_cnf->lq_level > 0)
      {
!       olsr_update_packet_loss(from_addr, in_if,
                                ntohs(olsr->olsr_seqno));
      }

Index: build_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** build_msg.c	7 Jan 2006 08:16:19 -0000	1.32
--- build_msg.c	14 Dec 2006 11:29:19 -0000	1.33
***************
*** 922,926 ****
  
    //printf("Sending MID (%d bytes)...\n", outputsize);
!   net_outbuffer_push(ifp, msg_buffer, curr_size);
  
  
--- 922,927 ----
  
    //printf("Sending MID (%d bytes)...\n", outputsize);
!   if(curr_size > OLSR_MID_IPV4_HDRSIZE)
!     net_outbuffer_push(ifp, msg_buffer, curr_size);
  
  
***************
*** 1019,1023 ****
  
    //printf("Sending MID (%d bytes)...\n", outputsize);
!   net_outbuffer_push(ifp, msg_buffer, curr_size);
  
    return OLSR_TRUE;
--- 1020,1025 ----
  
    //printf("Sending MID (%d bytes)...\n", outputsize);
!   if(curr_size > OLSR_MID_IPV6_HDRSIZE)
!     net_outbuffer_push(ifp, msg_buffer, curr_size);
  
    return OLSR_TRUE;

Index: routing_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/routing_table.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** routing_table.c	16 Nov 2005 23:55:54 -0000	1.23
--- routing_table.c	14 Dec 2006 11:29:20 -0000	1.24
***************
*** 283,287 ****
  		  if(link)
  		    {
! 		      struct interface *iface = if_ifwithaddr(&link->local_iface_addr);
  		      if(iface)
  			{
--- 283,288 ----
  		  if(link)
  		    {
! 		      struct interface *iface = link->if_name ? if_ifwithname(link->if_name) :
! 		                                if_ifwithaddr(&link->local_iface_addr);
  		      if(iface)
  			{
***************
*** 397,401 ****
  		  if(link)
  		    {
! 		      struct interface *iface = if_ifwithaddr(&link->local_iface_addr);
  		      if(iface)
  			{
--- 398,403 ----
  		  if(link)
  		    {
! 		    struct interface *iface = link->if_name ? if_ifwithname(link->if_name) :
! 		                                if_ifwithaddr(&link->local_iface_addr);
  		      if(iface)
  			{

Index: link_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** link_set.c	7 Jan 2006 08:16:20 -0000	1.63
--- link_set.c	14 Dec 2006 11:29:19 -0000	1.64
***************
*** 70,74 ****
  
  static struct link_entry *
! add_new_entry(union olsr_ip_addr *, union olsr_ip_addr *, union olsr_ip_addr *, double, double);
  
  static void
--- 70,74 ----
  
  static struct link_entry *
! add_new_entry(union olsr_ip_addr *, union olsr_ip_addr *, union olsr_ip_addr *, double, double, struct interface *);
  
  static void
***************
*** 203,207 ****
        //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
        //printf("%s : ", olsr_ip_to_string(main_addr)); 
!       if((link = lookup_link_entry(main_addr, &ifs->ip_addr)) != NULL)
  	{
  	  //printf("%d\n", lookup_link_status(link));
--- 203,207 ----
        //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
        //printf("%s : ", olsr_ip_to_string(main_addr)); 
!       if((link = lookup_link_entry(main_addr, ifs)) != NULL)
  	{
  	  //printf("%d\n", lookup_link_status(link));
***************
*** 216,220 ****
  	  //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
  	  //printf("%s : ", olsr_ip_to_string(&aliases->address)); 
! 	  if((link = lookup_link_entry(&aliases->alias, &ifs->ip_addr)) != NULL)
  	    {
  	      //printf("%d\n", lookup_link_status(link));
--- 216,220 ----
  	  //printf("\tChecking %s->", olsr_ip_to_string(&ifs->ip_addr));
  	  //printf("%s : ", olsr_ip_to_string(&aliases->address)); 
! 	  if((link = lookup_link_entry(&aliases->alias, ifs)) != NULL)
  	    {
  	      //printf("%d\n", lookup_link_status(link));
***************
*** 272,276 ****
        // find the interface for the link - we select the link with the
        // best local interface metric
!       tmp_if = if_ifwithaddr(&walker->local_iface_addr);
  
        if(!tmp_if)
--- 272,277 ----
        // find the interface for the link - we select the link with the
        // best local interface metric
!       tmp_if = walker->if_name ? if_ifwithname(walker->if_name) :
!               if_ifwithaddr(&walker->local_iface_addr);
  
        if(!tmp_if)
***************
*** 390,410 ****
   *@param vtime the validity time of the entry
   *@param htime the HELLO interval of the remote node
   */
  
  static struct link_entry *
! add_new_entry(union olsr_ip_addr *local, union olsr_ip_addr *remote, union olsr_ip_addr *remote_main, double vtime, double htime)
  {
    struct link_entry *tmp_link_set, *new_link;
    struct neighbor_entry *neighbor;
  
!   tmp_link_set = link_set;
! 
!   while(tmp_link_set)
!     {
!       if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) &&
! 	 COMP_IP(local, &tmp_link_set->local_iface_addr))
! 	return tmp_link_set;
!       tmp_link_set = tmp_link_set->next;
!     }
  
    /*
--- 391,404 ----
   *@param vtime the validity time of the entry
   *@param htime the HELLO interval of the remote node
+  *@param local_if the local interface
   */
  
  static struct link_entry *
! add_new_entry(union olsr_ip_addr *local, union olsr_ip_addr *remote, union olsr_ip_addr *remote_main, double vtime, double htime, struct interface *local_if)
  {
    struct link_entry *tmp_link_set, *new_link;
    struct neighbor_entry *neighbor;
  
!   if((tmp_link_set = lookup_link_entry(remote, local_if))) return tmp_link_set;
  
    /*
***************
*** 422,425 ****
--- 416,428 ----
  
    memset(new_link, 0 , sizeof(struct link_entry));
+   
+   /* copy if_name, if it is defined */
+   if (local_if->int_name)
+     {
+       new_link->if_name = olsr_malloc(strlen(local_if->int_name)+1, "target of if_name in new link entry");
+       strcpy(new_link->if_name, local_if->int_name);
+     } else 
+       new_link->if_name = NULL;
+ 
    /*
     * L_local_iface_addr = Address of the interface
***************
*** 560,564 ****
   */
  struct link_entry *
! lookup_link_entry(union olsr_ip_addr *remote, union olsr_ip_addr *local)
  {
    struct link_entry *tmp_link_set;
--- 563,567 ----
   */
  struct link_entry *
! lookup_link_entry(union olsr_ip_addr *remote, struct interface *local)
  {
    struct link_entry *tmp_link_set;
***************
*** 569,573 ****
      {
        if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) &&
! 	 COMP_IP(local, &tmp_link_set->local_iface_addr))
  	return tmp_link_set;
        tmp_link_set = tmp_link_set->next;
--- 572,579 ----
      {
        if(COMP_IP(remote, &tmp_link_set->neighbor_iface_addr) &&
! 	 (tmp_link_set->if_name ?
! 	  !strcmp(tmp_link_set->if_name, local->int_name) :
! 	  COMP_IP(&local->ip_addr, &tmp_link_set->local_iface_addr)
! 	 ))
  	return tmp_link_set;
        tmp_link_set = tmp_link_set->next;
***************
*** 605,609 ****
  
    /* Add if not registered */
!   entry = add_new_entry(local, remote, &message->source_addr, message->vtime, message->htime);
  
    /* Update ASYM_time */
--- 611,615 ----
  
    /* Add if not registered */
!   entry = add_new_entry(local, remote, &message->source_addr, message->vtime, message->htime, in_if);
  
    /* Update ASYM_time */
***************
*** 765,769 ****
  	      //olsr_delete_neighbor_if_no_link(&tmp_link_set->neighbor->neighbor_main_addr);
  	      changes_neighborhood = OLSR_TRUE;
! 
  	      free(tmp_link_set);
  	      tmp_link_set = last_link_entry;
--- 771,775 ----
  	      //olsr_delete_neighbor_if_no_link(&tmp_link_set->neighbor->neighbor_main_addr);
  	      changes_neighborhood = OLSR_TRUE;
! 	      free(tmp_link_set->if_name);
  	      free(tmp_link_set);
  	      tmp_link_set = last_link_entry;
***************
*** 781,784 ****
--- 787,791 ----
  	      changes_neighborhood = OLSR_TRUE;
  
+ 	      free(tmp_link_set->if_name);
  	      free(tmp_link_set);
  	      tmp_link_set = link_set;
***************
*** 995,999 ****
  }
  
! void olsr_update_packet_loss(union olsr_ip_addr *rem, union olsr_ip_addr *loc,
                               olsr_u16_t seqno)
  {
--- 1002,1006 ----
  }
  
! void olsr_update_packet_loss(union olsr_ip_addr *rem, struct interface *loc,
                               olsr_u16_t seqno)
  {

Index: link_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** link_set.h	23 Oct 2005 20:58:14 -0000	1.28
--- link_set.h	14 Dec 2006 11:29:19 -0000	1.29
***************
*** 56,59 ****
--- 56,60 ----
    union olsr_ip_addr local_iface_addr;
    union olsr_ip_addr neighbor_iface_addr;
+   char *if_name;
    clock_t SYM_time;
    clock_t ASYM_time;
***************
*** 121,125 ****
  
  struct link_entry *
! lookup_link_entry(union olsr_ip_addr *, union olsr_ip_addr *);
  
  struct link_entry *
--- 122,126 ----
  
  struct link_entry *
! lookup_link_entry(union olsr_ip_addr *, struct interface *);
  
  struct link_entry *
***************
*** 140,144 ****
  
  void 
! olsr_update_packet_loss(union olsr_ip_addr *, union olsr_ip_addr *, olsr_u16_t);
  
  void 
--- 141,145 ----
  
  void 
! olsr_update_packet_loss(union olsr_ip_addr *, struct interface *, olsr_u16_t);
  
  void 





More information about the Olsr-cvs mailing list