[Olsr-cvs] olsrd-current/src build_msg.c, 1.31, 1.32 build_msg.h, 1.12, 1.13 defs.c, 1.1, 1.2 defs.h, 1.51, 1.52 generate_msg.c, 1.23, 1.24 interfaces.c, 1.27, 1.28 interfaces.h, 1.31, 1.32 ipc_frontend.c, 1.27, 1.28 link_set.c, 1.62, 1.63 local_hna_set.c, 1.10, 1.11 lq_mpr.c, 1.10, 1.11 lq_packet.c, 1.19, 1.20 lq_route.c, 1.40, 1.41 main.c, 1.83, 1.84 mpr.c, 1.14, 1.15 mpr_selector_set.c, 1.14, 1.15 neighbor_table.c, 1.29, 1.30 net_olsr.c, 1.9, 1.10 net_olsr.h, 1.2, 1.3 olsr.c, 1.47, 1.48 olsr_cfg.h, 1.28, 1.29 olsr_protocol.h, 1.19, 1.20 packet.c, 1.20, 1.21 parser.c, 1.29, 1.30 parser.h, 1.10, 1.11 print_packet.c, 1.8, 1.9 process_package.c, 1.36, 1.37 scheduler.c, 1.33, 1.34 scheduler.h, 1.11, 1.12 tc_set.c, 1.23, 1.24

Andreas T�nnesen (spam-protected)
Sat Jan 7 09:16:24 CET 2006


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

Modified Files:
	build_msg.c build_msg.h defs.c defs.h generate_msg.c 
	interfaces.c interfaces.h ipc_frontend.c link_set.c 
	local_hna_set.c lq_mpr.c lq_packet.c lq_route.c main.c mpr.c 
	mpr_selector_set.c neighbor_table.c net_olsr.c net_olsr.h 
	olsr.c olsr_cfg.h olsr_protocol.h packet.c parser.c parser.h 
	print_packet.c process_package.c scheduler.c scheduler.h 
	tc_set.c 
Log Message:
Cleanup in use of extern variables. Rather trivial changes, but a lot of them

Index: generate_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/generate_msg.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** generate_msg.c	27 Feb 2005 18:39:43 -0000	1.23
--- generate_msg.c	7 Jan 2006 08:16:20 -0000	1.24
***************
*** 87,91 ****
    olsr_build_tc_packet(&tcpacket);
  
!   if(queue_tc(&tcpacket, ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
      {
        set_buffer_timer(ifn);
--- 87,91 ----
    olsr_build_tc_packet(&tcpacket);
  
!   if(queue_tc(&tcpacket, ifn) && TIMED_OUT(ifn->fwdtimer))
      {
        set_buffer_timer(ifn);
***************
*** 100,104 ****
    struct interface *ifn = (struct interface *)p;
    
!   if(queue_mid(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
      {
        set_buffer_timer(ifn);
--- 100,104 ----
    struct interface *ifn = (struct interface *)p;
    
!   if(queue_mid(ifn) && TIMED_OUT(ifn->fwdtimer))
      {
        set_buffer_timer(ifn);
***************
*** 114,118 ****
    struct interface *ifn = (struct interface *)p;
    
!   if(queue_hna(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr]))
      {
        set_buffer_timer(ifn);
--- 114,118 ----
    struct interface *ifn = (struct interface *)p;
    
!   if(queue_hna(ifn) && TIMED_OUT(ifn->fwdtimer))
      {
        set_buffer_timer(ifn);

Index: olsr_protocol.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_protocol.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** olsr_protocol.h	11 Oct 2005 14:55:55 -0000	1.19
--- olsr_protocol.h	7 Jan 2006 08:16:20 -0000	1.20
***************
*** 190,196 ****
   */
  
! #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, ipsize))
  
! #define COPY_IP(to, from) memcpy(to, from, ipsize)
  
  
--- 190,196 ----
   */
  
! #define COMP_IP(ip1, ip2) (!memcmp(ip1, ip2, olsr_cnf->ipsize))
  
! #define COPY_IP(to, from) memcpy(to, from, olsr_cnf->ipsize)
  
  

Index: link_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** link_set.c	17 Nov 2005 04:25:44 -0000	1.62
--- link_set.c	7 Jan 2006 08:16:20 -0000	1.63
***************
*** 96,100 ****
  
    /* Timers */
!   hold_time_neighbor = (NEIGHB_HOLD_TIME*1000) / system_tick_divider;
  
    olsr_register_timeout_function(&olsr_time_out_link_set);
--- 96,100 ----
  
    /* Timers */
!   hold_time_neighbor = (NEIGHB_HOLD_TIME*1000) / olsr_cnf->system_tick_divider;
  
    olsr_register_timeout_function(&olsr_time_out_link_set);
***************
*** 982,986 ****
        // announce this neighbour
  
!       changes = OLSR_TRUE;
      }
  }
--- 982,986 ----
        // announce this neighbour
  
!       signal_link_changes(OLSR_TRUE);
      }
  }

Index: neighbor_table.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/neighbor_table.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** neighbor_table.c	29 Nov 2005 18:37:58 -0000	1.29
--- neighbor_table.c	7 Jan 2006 08:16:20 -0000	1.30
***************
*** 365,369 ****
  	  changes_topology = OLSR_TRUE;
  	  if(olsr_cnf->tc_redundancy > 1)
! 	    changes = OLSR_TRUE;
  	}
        entry->status = SYM;
--- 365,369 ----
  	  changes_topology = OLSR_TRUE;
  	  if(olsr_cnf->tc_redundancy > 1)
! 	    signal_link_changes(OLSR_TRUE);
  	}
        entry->status = SYM;
***************
*** 376,380 ****
  	  changes_topology = OLSR_TRUE;
  	  if(olsr_cnf->tc_redundancy > 1)
! 	    changes = OLSR_TRUE;
  	}
        /* else N_status is set to NOT_SYM */
--- 376,380 ----
  	  changes_topology = OLSR_TRUE;
  	  if(olsr_cnf->tc_redundancy > 1)
! 	    signal_link_changes(OLSR_TRUE);
  	}
        /* else N_status is set to NOT_SYM */

Index: interfaces.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** interfaces.c	3 Jun 2005 08:00:55 -0000	1.27
--- interfaces.c	7 Jan 2006 08:16:20 -0000	1.28
***************
*** 90,94 ****
        memset(&addrsock, 0, sizeof (addrsock));
        addrsock.sin_family = AF_INET;
!       addrsock.sin_port = olsr_udp_port;
        (addrsock.sin_addr).s_addr = INADDR_ANY;
      }
--- 90,94 ----
        memset(&addrsock, 0, sizeof (addrsock));
        addrsock.sin_family = AF_INET;
!       addrsock.sin_port = htons(OLSRPORT);
        (addrsock.sin_addr).s_addr = INADDR_ANY;
      }
***************
*** 98,102 ****
        memset(&addrsock6, 0, sizeof (addrsock6));
        addrsock6.sin6_family = AF_INET6;
!       addrsock6.sin6_port = olsr_udp_port;
        //(addrsock6.sin6_addr).s_addr = IN6ADDR_ANY_INIT;
      }
--- 98,102 ----
        memset(&addrsock6, 0, sizeof (addrsock6));
        addrsock6.sin6_family = AF_INET6;
!       addrsock6.sin6_port = htons(OLSRPORT);
        //(addrsock6.sin6_addr).s_addr = IN6ADDR_ANY_INIT;
      }

Index: print_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/print_packet.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** print_packet.c	19 Nov 2005 08:49:44 -0000	1.8
--- print_packet.c	7 Jan 2006 08:16:20 -0000	1.9
***************
*** 286,290 ****
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8])
  	    {
! 	      olsr_u8_t *quality = (olsr_u8_t *)haddr + ipsize;
  	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
--- 286,290 ----
  	       haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[8])
  	    {
! 	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
  	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
***************
*** 314,318 ****
  	       haddr++)
  	    {
! 	      olsr_u8_t *quality = (olsr_u8_t *)haddr + ipsize;
  	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
--- 314,318 ----
  	       haddr++)
  	    {
! 	      olsr_u8_t *quality = (olsr_u8_t *)haddr + olsr_cnf->ipsize;
  	      fprintf(handle, "    ++ %s\n", olsr_ip_to_string(haddr));
  	      fprintf(handle, "    ++ LQ = %d, RLQ = %d\n", quality[0], quality[1]);
***************
*** 336,345 ****
      {
        fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += ipsize;
        fprintf(handle, "    +LQ: %d, ", *data);
        data += 1;
        fprintf(handle, "RLQ: %d\n", *data);
        data += 2;
!       remsize -= (ipsize + 4);
      }
  
--- 336,345 ----
      {
        fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += olsr_cnf->ipsize;
        fprintf(handle, "    +LQ: %d, ", *data);
        data += 1;
        fprintf(handle, "RLQ: %d\n", *data);
        data += 2;
!       remsize -= (olsr_cnf->ipsize + 4);
      }
  
***************
*** 360,366 ****
      {
        fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += ipsize;
  
!       remsize -= ipsize;
      }
  
--- 360,366 ----
      {
        fprintf(handle, "    +Neighbor: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += olsr_cnf->ipsize;
  
!       remsize -= olsr_cnf->ipsize;
      }
  
***************
*** 376,384 ****
      {
        fprintf(handle, "    +Network: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += ipsize;
        fprintf(handle, "    +Netmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += ipsize;
  
!       remsize -= (ipsize*2);
      }
  
--- 376,384 ----
      {
        fprintf(handle, "    +Network: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += olsr_cnf->ipsize;
        fprintf(handle, "    +Netmask: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += olsr_cnf->ipsize;
  
!       remsize -= (olsr_cnf->ipsize*2);
      }
  
***************
*** 393,398 ****
      {
        fprintf(handle, "    +Alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += ipsize;
!       remsize -= ipsize;
      }
  }
--- 393,398 ----
      {
        fprintf(handle, "    +Alias: %s\n", olsr_ip_to_string((union olsr_ip_addr *) data));
!       data += olsr_cnf->ipsize;
!       remsize -= olsr_cnf->ipsize;
      }
  }

Index: interfaces.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/interfaces.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** interfaces.h	6 Jan 2006 06:54:04 -0000	1.31
--- interfaces.h	7 Jan 2006 08:16:20 -0000	1.32
***************
*** 46,49 ****
--- 46,50 ----
  #include <sys/types.h>
  #include <sys/socket.h>
+ #include <time.h>
  
  #include "olsr_types.h"
***************
*** 136,139 ****
--- 137,142 ----
    struct        vtimes valtimes;
  
+   clock_t       fwdtimer;                       /* Timeout for OLSR forwarding on this if */
+ 
    void          *libnet_ctx;                    /* libnet context(void to avoid dependency */
  

Index: local_hna_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/local_hna_set.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** local_hna_set.c	27 Feb 2005 18:39:43 -0000	1.10
--- local_hna_set.c	7 Jan 2006 08:16:20 -0000	1.11
***************
*** 111,115 ****
    while(h6)
      {
!       if((memcmp(net, &h6->net, ipsize) == 0) && 
  	 (prefix_len == h6->prefix_len))
  	{
--- 111,115 ----
    while(h6)
      {
!       if((memcmp(net, &h6->net, olsr_cnf->ipsize) == 0) && 
  	 (prefix_len == h6->prefix_len))
  	{

Index: process_package.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/process_package.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** process_package.c	29 Nov 2005 18:38:40 -0000	1.36
--- process_package.c	7 Jan 2006 08:16:20 -0000	1.37
***************
*** 53,56 ****
--- 53,57 ----
  #include "duplicate_set.h"
  #include "rebuild_packet.h"
+ #include "scheduler.h"
  
  
***************
*** 143,147 ****
            // announce this neighbour
  
!           changes = OLSR_TRUE;
          }
      }
--- 144,148 ----
            // announce this neighbour
  
! 	  signal_link_changes(OLSR_TRUE);
          }
      }

Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** lq_route.c	29 Nov 2005 18:37:58 -0000	1.40
--- lq_route.c	7 Jan 2006 08:16:20 -0000	1.41
***************
*** 75,79 ****
  static int avl_comp_ipv6(void *ip1, void *ip2)
  {
!   return memcmp(ip1, ip2, ipsize);
  }
  
--- 75,79 ----
  static int avl_comp_ipv6(void *ip1, void *ip2)
  {
!   return memcmp(ip1, ip2, olsr_cnf->ipsize);
  }
  
***************
*** 206,210 ****
    // add the vertex to the list, if it's not us
  
!   if ((*comp)(&main_addr, node->key) != 0)
    {
      vert->node.data = vert;
--- 206,210 ----
    // add the vertex to the list, if it's not us
  
!   if ((*comp)(&olsr_cnf->main_addr, node->key) != 0)
    {
      vert->node.data = vert;
***************
*** 224,228 ****
    // make ourselves the first vertex in the list
  
!   node = avl_find(vertex_tree, &main_addr);
    vert = node->data;
  
--- 224,228 ----
    // make ourselves the first vertex in the list
  
!   node = avl_find(vertex_tree, &olsr_cnf->main_addr);
    vert = node->data;
  
***************
*** 371,375 ****
    struct interface *inter;
  
!   if (ipsize == 4)
      avl_comp = avl_comp_ipv4;
  
--- 371,375 ----
    struct interface *inter;
  
!   if (olsr_cnf->ipsize == 4)
      avl_comp = avl_comp_ipv4;
  
***************
*** 384,388 ****
    // add ourselves to the vertex tree
  
!   add_vertex(&vertex_tree, &main_addr, 0.0);
  
    // add our neighbours
--- 384,388 ----
    // add ourselves to the vertex tree
  
!   add_vertex(&vertex_tree, &olsr_cnf->main_addr, 0.0);
  
    // add our neighbours
***************
*** 435,439 ****
              etx = 1.0 / (link->loss_link_quality2 * link->neigh_link_quality2);
  
!             add_edge(&vertex_tree, &neigh->neighbor_main_addr, &main_addr, etx);
            }
        }
--- 435,439 ----
              etx = 1.0 / (link->loss_link_quality2 * link->neigh_link_quality2);
  
!             add_edge(&vertex_tree, &neigh->neighbor_main_addr, &olsr_cnf->main_addr, etx);
            }
        }

Index: defs.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/defs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** defs.c	29 May 2005 12:47:45 -0000	1.1
--- defs.c	7 Jan 2006 08:16:20 -0000	1.2
***************
*** 5,13 ****
  struct olsrd_config *olsr_cnf;
  
- olsr_u16_t system_tick_divider;
- 
- int exit_value;
- 
- 
  /* Timer data */
  clock_t now_times;              /* current idea of times(2) reported uptime */
--- 5,8 ----
***************
*** 15,46 ****
  struct tm *nowtm;		/* current idea of time (in tm) */
  
- olsr_bool disp_pack_in;         /* display incoming packet content? */
- olsr_bool disp_pack_out;        /* display outgoing packet content? */
- 
- olsr_bool del_gws;
- 
- float will_int;
- float max_jitter;
- 
- size_t ipsize;
- 
- union olsr_ip_addr main_addr;
- 
- int olsr_udp_port;
- 
- int ioctl_s;
- 
- #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
- int rts;
- #endif
- 
- float max_tc_vtime;
- 
- clock_t fwdtimer[MAX_IFS];	/* forwarding timer */
- 
- int minsize;
- 
- olsr_bool changes;                /* is set if changes occur in MPRS set */ 
- 
- /* TC empty message sending */
- clock_t send_empty_tc;
--- 10,11 ----

Index: net_olsr.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** net_olsr.h	6 Jan 2006 06:54:37 -0000	1.2
--- net_olsr.h	7 Jan 2006 08:16:20 -0000	1.3
***************
*** 75,78 ****
--- 75,81 ----
  
  void
+ net_set_disp_pack_out(olsr_bool);
+ 
+ void
  init_net(void);
  

Index: defs.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/defs.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** defs.h	4 Jan 2006 15:51:19 -0000	1.51
--- defs.h	7 Jan 2006 08:16:20 -0000	1.52
***************
*** 75,78 ****
--- 75,79 ----
  #define MAX_IFS                 16
  
+ #define MIN_PACKET_SIZE(ver)  (int)(sizeof(olsr_u8_t) * ((ver == AF_INET) ? 4 : 7))
  /* Debug helper macro */
  #ifdef DEBUG
***************
*** 98,102 ****
     according to system ticks returned by times(2) */
  #define GET_TIMESTAMP(s1) \
!         (now_times + ((s1) / system_tick_divider))
  
  #define TIMED_OUT(s1) \
--- 99,103 ----
     according to system ticks returned by times(2) */
  #define GET_TIMESTAMP(s1) \
!         (now_times + ((s1) / olsr_cnf->system_tick_divider))
  
  #define TIMED_OUT(s1) \
***************
*** 127,136 ****
  extern struct olsrd_config *olsr_cnf;
  
- /* Global tick resolution */
- extern olsr_u16_t system_tick_divider;
- 
- extern int exit_value; /* Global return value for process termination */
- 
- 
  /* Timer data */
  extern clock_t now_times;              /* current idea of times(2) reported uptime */
--- 128,131 ----
***************
*** 138,180 ****
  extern struct tm *nowtm;		/* current idea of time (in tm) */
  
- extern olsr_bool disp_pack_in;         /* display incoming packet content? */
- extern olsr_bool disp_pack_out;        /* display outgoing packet content? */
- 
- extern olsr_bool del_gws;
- 
- /*
-  * Timer values
-  */
- 
- extern float will_int;
- extern float max_jitter;
- 
- extern size_t ipsize;
- 
- /* Main address of this node */
- extern union olsr_ip_addr main_addr;
- 
- /* OLSR UPD port */
- extern int olsr_udp_port;
- 
- /* The socket used for all ioctls */
- extern int ioctl_s;
- 
- /* routing socket */
- #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
- extern int rts;
- #endif
- 
- extern float max_tc_vtime;
- 
- extern clock_t fwdtimer[MAX_IFS];	/* forwarding timer */
- 
- extern int minsize;
- 
- extern olsr_bool changes;                /* is set if changes occur in MPRS set */ 
- 
- /* TC empty message sending */
- extern clock_t send_empty_tc;
- 
  /*
   *IPC functions
--- 133,136 ----

Index: packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/packet.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** packet.c	27 Feb 2005 10:43:38 -0000	1.20
--- packet.c	7 Jan 2006 08:16:20 -0000	1.21
***************
*** 47,55 ****
  #include "olsr.h"
  #include "neighbor_table.h"
  
  static olsr_bool sending_tc = OLSR_FALSE;
  
- 
- 
  /**
   *Free the memory allocated for a HELLO packet.
--- 47,54 ----
  #include "olsr.h"
  #include "neighbor_table.h"
+ #include "build_msg.h"
  
  static olsr_bool sending_tc = OLSR_FALSE;
  
  /**
   *Free the memory allocated for a HELLO packet.
***************
*** 114,118 ****
  
    message->ttl = 1;  
!   COPY_IP(&message->source_addr, &main_addr);
  
  #ifdef DEBUG
--- 113,117 ----
  
    message->ttl = 1;  
!   COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
  
  #ifdef DEBUG
***************
*** 356,361 ****
    message->ansn = get_local_ansn();
  
!   COPY_IP(&message->originator, &main_addr);
!   COPY_IP(&message->source_addr, &main_addr);
    
  
--- 355,360 ----
    message->ansn = get_local_ansn();
  
!   COPY_IP(&message->originator, &olsr_cnf->main_addr);
!   COPY_IP(&message->source_addr, &olsr_cnf->main_addr);
    
  
***************
*** 431,435 ****
  	  /* Send empty TC */
  	  OLSR_PRINTF(3, "No more MPR selectors - will send empty TCs\n")
! 	  send_empty_tc = GET_TIMESTAMP((max_tc_vtime*3)*1000);
  
  	  sending_tc = OLSR_FALSE;
--- 430,434 ----
  	  /* Send empty TC */
  	  OLSR_PRINTF(3, "No more MPR selectors - will send empty TCs\n")
! 	  set_empty_tc_timer(GET_TIMESTAMP((olsr_cnf->max_tc_vtime*3)*1000));
  
  	  sending_tc = OLSR_FALSE;

Index: lq_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** lq_packet.c	17 Nov 2005 01:58:51 -0000	1.19
--- lq_packet.c	7 Jan 2006 08:16:20 -0000	1.20
***************
*** 54,57 ****
--- 54,58 ----
  #include "hysteresis.h"
  #include "olsr.h"
+ #include "build_msg.h"
  
  olsr_bool lq_tc_pending = OLSR_FALSE;
***************
*** 71,75 ****
    lq_hello->comm.size = 0;
  
!   COPY_IP(&lq_hello->comm.orig, &main_addr);
  
    lq_hello->comm.ttl = 1;
--- 72,76 ----
    lq_hello->comm.size = 0;
  
!   COPY_IP(&lq_hello->comm.orig, &olsr_cnf->main_addr);
  
    lq_hello->comm.ttl = 1;
***************
*** 164,168 ****
    lq_tc->comm.size = 0;
  
!   COPY_IP(&lq_tc->comm.orig, &main_addr);
  
    if (olsr_cnf->lq_fish > 0)
--- 165,169 ----
    lq_tc->comm.size = 0;
  
!   COPY_IP(&lq_tc->comm.orig, &olsr_cnf->main_addr);
  
    if (olsr_cnf->lq_fish > 0)
***************
*** 182,186 ****
    lq_tc->comm.seqno = get_msg_seqno();
  
!   COPY_IP(&lq_tc->from, &main_addr);
  
    lq_tc->ansn = get_local_ansn();
--- 183,187 ----
    lq_tc->comm.seqno = get_msg_seqno();
  
!   COPY_IP(&lq_tc->from, &olsr_cnf->main_addr);
  
    lq_tc->ansn = get_local_ansn();
***************
*** 341,345 ****
    // force signed comparison
  
!   if (rem < (int)(sizeof (struct lq_hello_info_header) + ipsize + 4))
    {
      net_output(outif);
--- 342,346 ----
    // force signed comparison
  
!   if (rem < (int)(sizeof (struct lq_hello_info_header) + olsr_cnf->ipsize + 4))
    {
      net_output(outif);
***************
*** 371,375 ****
                // information
  
!               req = ipsize + 4;
  
                // no, we also need space for an info header, as this is the
--- 372,376 ----
                // information
  
!               req = olsr_cnf->ipsize + 4;
  
                // no, we also need space for an info header, as this is the
***************
*** 426,430 ****
  
                COPY_IP(buff + size, &neigh->addr);
!               size += ipsize;
  
                // add the corresponding link quality
--- 427,431 ----
  
                COPY_IP(buff + size, &neigh->addr);
!               size += olsr_cnf->ipsize;
  
                // add the corresponding link quality
***************
*** 501,505 ****
    // force signed comparison
  
!   if (rem < (int)(ipsize + 4))
    {
      net_output(outif);
--- 502,506 ----
    // force signed comparison
  
!   if (rem < (int)(olsr_cnf->ipsize + 4))
    {
      net_output(outif);
***************
*** 517,521 ****
        // force signed comparison
  
!       if ((int)(size + ipsize + 4) > rem)
          {
            // finalize the OLSR header
--- 518,522 ----
        // force signed comparison
  
!       if ((int)(size + olsr_cnf->ipsize + 4) > rem)
          {
            // finalize the OLSR header
***************
*** 540,544 ****
  
        COPY_IP(buff + size, &neigh->main);
!       size += ipsize;
  
        // add the corresponding link quality
--- 541,545 ----
  
        COPY_IP(buff + size, &neigh->main);
!       size += olsr_cnf->ipsize;
  
        // add the corresponding link quality
***************
*** 645,649 ****
  
            COPY_IP(&neigh->addr, curr);
!           curr += ipsize;
  
            neigh->link_quality = (double)*curr++ / 255.0;
--- 646,650 ----
  
            COPY_IP(&neigh->addr, curr);
!           curr += olsr_cnf->ipsize;
  
            neigh->link_quality = (double)*curr++ / 255.0;
***************
*** 703,707 ****
  
        COPY_IP(&neigh->main, curr);
!       curr += ipsize;
  
        neigh->link_quality = (double)*curr++ / 255.0;
--- 704,708 ----
  
        COPY_IP(&neigh->main, curr);
!       curr += olsr_cnf->ipsize;
  
        neigh->link_quality = (double)*curr++ / 255.0;
***************
*** 765,769 ****
        // initialize timer
  
!       send_empty_tc = GET_TIMESTAMP((max_tc_vtime * 3) * 1000);
  
        prev_empty = 1;
--- 766,770 ----
        // initialize timer
  
!       set_empty_tc_timer(GET_TIMESTAMP((olsr_cnf->max_tc_vtime * 3) * 1000));
  
        prev_empty = 1;
***************
*** 776,780 ****
    // c) this is not the first empty message, send if timer hasn't fired
  
!   else if (!TIMED_OUT(send_empty_tc))
      serialize_lq_tc(&lq_tc, outif);
  
--- 777,781 ----
    // c) this is not the first empty message, send if timer hasn't fired
  
!   else if (!TIMED_OUT(get_empty_tc_timer()))
      serialize_lq_tc(&lq_tc, outif);
  
***************
*** 783,787 ****
    destroy_lq_tc(&lq_tc);
  
!   if(net_output_pending(outif) && TIMED_OUT(fwdtimer[outif->if_nr]))
      set_buffer_timer(outif);
  }
--- 784,788 ----
    destroy_lq_tc(&lq_tc);
  
!   if(net_output_pending(outif) && TIMED_OUT(outif->fwdtimer))
      set_buffer_timer(outif);
  }

Index: net_olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/net_olsr.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** net_olsr.c	6 Jan 2006 07:21:04 -0000	1.9
--- net_olsr.c	7 Jan 2006 08:16:20 -0000	1.10
***************
*** 55,58 ****
--- 55,61 ----
  extern olsr_bool lq_tc_pending;
  
+ static olsr_bool disp_pack_out = OLSR_FALSE;
+ 
+ 
  #ifdef WIN32
  #define perror(x) WinSockPError(x)
***************
*** 103,106 ****
--- 106,116 ----
  #endif
  
+ 
+ void
+ net_set_disp_pack_out(olsr_bool val)
+ {
+   disp_pack_out = val;
+ }
+ 
  void
  init_net()
***************
*** 441,445 ****
  
        if (sin->sin_port == 0)
! 	sin->sin_port = olsr_udp_port;
      }
    else
--- 451,455 ----
  
        if (sin->sin_port == 0)
! 	sin->sin_port = htons(OLSRPORT);
      }
    else
***************
*** 596,600 ****
    i = 0;
  
!   memset(adr, 0, ipsize);
  
    for(;p > 0; p -= 8)
--- 606,610 ----
    i = 0;
  
!   memset(adr, 0, olsr_cnf->ipsize);
  
    for(;p > 0; p -= 8)

Index: build_msg.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** build_msg.c	10 Nov 2005 19:35:12 -0000	1.31
--- build_msg.c	7 Jan 2006 08:16:19 -0000	1.32
***************
*** 67,70 ****
--- 67,72 ----
  static olsr_u8_t msg_buffer[MAXMESSAGESIZE - OLSR_HEADERSIZE];
  
+ static clock_t send_empty_tc; /* TC empty message sending */
+ 
  /* Prototypes for internal functions */
  
***************
*** 97,101 ****
--- 99,121 ----
  serialize_hna6(struct interface *);
  
+ /**
+  * Set the timer that controls the generation of
+  * empty TC messages
+  */
+ void
+ set_empty_tc_timer(clock_t empty_tc_new)
+ {
+   send_empty_tc = empty_tc_new;
+ }
  
+ /**
+  * Get the timer that controls the generation of
+  * empty TC messages
+  */
+ clock_t
+ get_empty_tc_timer()
+ {
+   return send_empty_tc;
+ }
  
  /**
***************
*** 279,283 ****
    m->v4.olsr_msgtype = HELLO_MESSAGE;
    /* Set source(main) addr */
!   COPY_IP(&m->v4.originator, &main_addr);
  
    m->v4.olsr_vtime = ifp->valtimes.hello;
--- 299,303 ----
    m->v4.olsr_msgtype = HELLO_MESSAGE;
    /* Set source(main) addr */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
  
    m->v4.olsr_vtime = ifp->valtimes.hello;
***************
*** 330,334 ****
  	       * 4 bytes
  	       */
! 	      if((curr_size + ipsize + (first_entry ? 4 : 0)) > remainsize)
  		{
  		  /* Only send partial HELLO if it contains data */
--- 350,354 ----
  	       * 4 bytes
  	       */
! 	      if((curr_size + olsr_cnf->ipsize + (first_entry ? 4 : 0)) > remainsize)
  		{
  		  /* Only send partial HELLO if it contains data */
***************
*** 361,365 ****
  		  
  		  /* Sanity check */
! 		  check_buffspace(curr_size + ipsize + 4, remainsize, "HELLO2");
  		}
  	      
--- 381,385 ----
  		  
  		  /* Sanity check */
! 		  check_buffspace(curr_size + olsr_cnf->ipsize + 4, remainsize, "HELLO2");
  		}
  	      
***************
*** 376,380 ****
  	      /* Point to next address */
  	      haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4];
! 	      curr_size += ipsize; /* IP address added */
  
  	      first_entry = OLSR_FALSE;
--- 396,400 ----
  	      /* Point to next address */
  	      haddr = (union olsr_ip_addr *)&haddr->v6.s6_addr[4];
! 	      curr_size += olsr_cnf->ipsize; /* IP address added */
  
  	      first_entry = OLSR_FALSE;
***************
*** 439,443 ****
        remainsize = net_outbuffer_bytes_left(ifp);
      }
!   check_buffspace(curr_size + ipsize + 4, remainsize, "HELLO");
  
    h6 = &m->v6.message.hello;
--- 459,463 ----
        remainsize = net_outbuffer_bytes_left(ifp);
      }
!   check_buffspace(curr_size + olsr_cnf->ipsize + 4, remainsize, "HELLO");
  
    h6 = &m->v6.message.hello;
***************
*** 450,454 ****
    m->v6.hopcnt = 0;
    /* Set source(main) addr */
!   COPY_IP(&m->v6.originator, &main_addr);
    m->v6.olsr_msgtype = HELLO_MESSAGE;
  
--- 470,474 ----
    m->v6.hopcnt = 0;
    /* Set source(main) addr */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
    m->v6.olsr_msgtype = HELLO_MESSAGE;
  
***************
*** 496,500 ****
  	       * 4 bytes
  	       */
! 	      if((curr_size + ipsize + (first_entry ? 4 : 0)) > remainsize)
  		{
  		  /* Only send partial HELLO if it contains data */
--- 516,520 ----
  	       * 4 bytes
  	       */
! 	      if((curr_size + olsr_cnf->ipsize + (first_entry ? 4 : 0)) > remainsize)
  		{
  		  /* Only send partial HELLO if it contains data */
***************
*** 525,529 ****
  		  remainsize = net_outbuffer_bytes_left(ifp);
  
! 		  check_buffspace(curr_size + ipsize + 4, remainsize, "HELLO2");
  		      
  		}
--- 545,549 ----
  		  remainsize = net_outbuffer_bytes_left(ifp);
  
! 		  check_buffspace(curr_size + olsr_cnf->ipsize + 4, remainsize, "HELLO2");
  		      
  		}
***************
*** 541,545 ****
  	      /* Point to next address */
  	      haddr++;
! 	      curr_size += ipsize; /* IP address added */ 
  		  
  	      first_entry = OLSR_FALSE;
--- 561,565 ----
  	      /* Point to next address */
  	      haddr++;
! 	      curr_size += olsr_cnf->ipsize; /* IP address added */ 
  		  
  	      first_entry = OLSR_FALSE;
***************
*** 626,630 ****
      {
        /*If packet is to be chomped */
!       if((curr_size + ipsize) > remainsize)
  	{
  
--- 646,650 ----
      {
        /*If packet is to be chomped */
!       if((curr_size + olsr_cnf->ipsize) > remainsize)
  	{
  
***************
*** 650,654 ****
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + ipsize, remainsize, "TC2");
  
  	}
--- 670,674 ----
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + olsr_cnf->ipsize, remainsize, "TC2");
  
  	}
***************
*** 660,664 ****
        COPY_IP(&mprsaddr->addr, &mprs->address);
  
!       curr_size += ipsize;
        mprsaddr++;
      }
--- 680,684 ----
        COPY_IP(&mprsaddr->addr, &mprs->address);
  
!       curr_size += olsr_cnf->ipsize;
        mprsaddr++;
      }
***************
*** 752,756 ****
  	    
        /*If packet is to be chomped */
!       if((curr_size + ipsize) > remainsize)
  	{
  	  /* Only add TC message if it contains data */
--- 772,776 ----
  	    
        /*If packet is to be chomped */
!       if((curr_size + olsr_cnf->ipsize) > remainsize)
  	{
  	  /* Only add TC message if it contains data */
***************
*** 771,775 ****
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + ipsize, remainsize, "TC2");
  
  	}
--- 791,795 ----
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + olsr_cnf->ipsize, remainsize, "TC2");
  
  	}
***************
*** 780,784 ****
  #endif
        COPY_IP(&mprsaddr6->addr, &mprs->address);
!       curr_size += ipsize;
  
        mprsaddr6++;
--- 800,804 ----
  #endif
        COPY_IP(&mprsaddr6->addr, &mprs->address);
!       curr_size += olsr_cnf->ipsize;
  
        mprsaddr6++;
***************
*** 853,857 ****
    m->v4.ttl = MAX_TTL;
    /* Set main(first) address */
!   COPY_IP(&m->v4.originator, &main_addr);
    m->v4.olsr_msgtype = MID_MESSAGE;
    m->v4.olsr_vtime = ifp->valtimes.mid;
--- 873,877 ----
    m->v4.ttl = MAX_TTL;
    /* Set main(first) address */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
    m->v4.olsr_msgtype = MID_MESSAGE;
    m->v4.olsr_vtime = ifp->valtimes.mid;
***************
*** 862,869 ****
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&main_addr, &ifs->ip_addr))
  	{
  
! 	  if((curr_size + ipsize) > remainsize)
  	    {
  	      /* Only add MID message if it contains data */
--- 882,889 ----
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
  
! 	  if((curr_size + olsr_cnf->ipsize) > remainsize)
  	    {
  	      /* Only add MID message if it contains data */
***************
*** 893,897 ****
  	  COPY_IP(&addrs->addr, &ifs->ip_addr);
  	  addrs++;
! 	  curr_size += ipsize;
  	}
      }
--- 913,917 ----
  	  COPY_IP(&addrs->addr, &ifs->ip_addr);
  	  addrs++;
! 	  curr_size += olsr_cnf->ipsize;
  	}
      }
***************
*** 943,947 ****
        remainsize = net_outbuffer_bytes_left(ifp);
      }
!   check_buffspace(curr_size + ipsize, remainsize, "MID");
  
    m = (union olsr_message *)msg_buffer;
--- 963,967 ----
        remainsize = net_outbuffer_bytes_left(ifp);
      }
!   check_buffspace(curr_size + olsr_cnf->ipsize, remainsize, "MID");
  
    m = (union olsr_message *)msg_buffer;
***************
*** 953,957 ****
    m->v6.olsr_vtime = ifp->valtimes.mid;
    /* Set main(first) address */
!   COPY_IP(&m->v6.originator, &main_addr);
     
  
--- 973,977 ----
    m->v6.olsr_vtime = ifp->valtimes.mid;
    /* Set main(first) address */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
     
  
***************
*** 961,967 ****
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&main_addr, &ifs->ip_addr))
  	{
! 	  if((curr_size + ipsize) > remainsize)
  	    {
  	      /* Only add MID message if it contains data */
--- 981,987 ----
    for(ifs = ifnet; ifs != NULL; ifs = ifs->int_next)
      {
!       if(!COMP_IP(&olsr_cnf->main_addr, &ifs->ip_addr))
  	{
! 	  if((curr_size + olsr_cnf->ipsize) > remainsize)
  	    {
  	      /* Only add MID message if it contains data */
***************
*** 981,985 ****
  	      net_output(ifp);
  	      remainsize = net_outbuffer_bytes_left(ifp);
! 	      check_buffspace(curr_size + ipsize, remainsize, "MID2");
  	    }
  #ifdef DEBUG
--- 1001,1005 ----
  	      net_output(ifp);
  	      remainsize = net_outbuffer_bytes_left(ifp);
! 	      check_buffspace(curr_size + olsr_cnf->ipsize, remainsize, "MID2");
  	    }
  #ifdef DEBUG
***************
*** 991,995 ****
  	  COPY_IP(&addrs6->addr, &ifs->ip_addr);
  	  addrs6++;
! 	  curr_size += ipsize;
  	}
      }
--- 1011,1015 ----
  	  COPY_IP(&addrs6->addr, &ifs->ip_addr);
  	  addrs6++;
! 	  curr_size += olsr_cnf->ipsize;
  	}
      }
***************
*** 1042,1046 ****
    
    /* Fill header */
!   COPY_IP(&m->v4.originator, &main_addr);
    m->v4.hopcnt = 0;
    m->v4.ttl = MAX_TTL;
--- 1062,1066 ----
    
    /* Fill header */
!   COPY_IP(&m->v4.originator, &olsr_cnf->main_addr);
    m->v4.hopcnt = 0;
    m->v4.ttl = MAX_TTL;
***************
*** 1053,1057 ****
    while(h)
      {
!       if((curr_size + (2 * ipsize)) > remainsize)
  	{
  	  /* Only add HNA message if it contains data */
--- 1073,1077 ----
    while(h)
      {
!       if((curr_size + (2 * olsr_cnf->ipsize)) > remainsize)
  	{
  	  /* Only add HNA message if it contains data */
***************
*** 1069,1073 ****
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + (2 * ipsize), remainsize, "HNA2");
  	}
  #ifdef DEBUG
--- 1089,1093 ----
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + (2 * olsr_cnf->ipsize), remainsize, "HNA2");
  	}
  #ifdef DEBUG
***************
*** 1079,1083 ****
        COPY_IP(&pair->netmask, &h->netmask);
        pair++;
!       curr_size += (2 * ipsize);
        h = h->next;
      }
--- 1099,1103 ----
        COPY_IP(&pair->netmask, &h->netmask);
        pair++;
!       curr_size += (2 * olsr_cnf->ipsize);
        h = h->next;
      }
***************
*** 1132,1136 ****
  
    /* Fill header */
!   COPY_IP(&m->v6.originator, &main_addr);
    m->v6.hopcnt = 0;
    m->v6.ttl = MAX_TTL;
--- 1152,1156 ----
  
    /* Fill header */
!   COPY_IP(&m->v6.originator, &olsr_cnf->main_addr);
    m->v6.hopcnt = 0;
    m->v6.ttl = MAX_TTL;
***************
*** 1143,1147 ****
    while(h)
      {
!       if((curr_size + (2 * ipsize)) > remainsize)
  	{
  	  /* Only add HNA message if it contains data */
--- 1163,1167 ----
    while(h)
      {
!       if((curr_size + (2 * olsr_cnf->ipsize)) > remainsize)
  	{
  	  /* Only add HNA message if it contains data */
***************
*** 1159,1163 ****
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + (2 * ipsize), remainsize, "HNA2");
  	}
  #ifdef DEBUG
--- 1179,1183 ----
  	  net_output(ifp);
  	  remainsize = net_outbuffer_bytes_left(ifp);
! 	  check_buffspace(curr_size + (2 * olsr_cnf->ipsize), remainsize, "HNA2");
  	}
  #ifdef DEBUG
***************
*** 1170,1174 ****
        COPY_IP(&pair6->netmask, &tmp_netmask);
        pair6++;
!       curr_size += (2 * ipsize);
        h = h->next;
      }
--- 1190,1194 ----
        COPY_IP(&pair6->netmask, &tmp_netmask);
        pair6++;
!       curr_size += (2 * olsr_cnf->ipsize);
        h = h->next;
      }

Index: ipc_frontend.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/ipc_frontend.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** ipc_frontend.c	10 Nov 2005 19:33:57 -0000	1.27
--- ipc_frontend.c	7 Jan 2006 08:16:20 -0000	1.28
***************
*** 498,502 ****
   
    /* Main addr */
!   COPY_IP(&net_msg->main_addr, &main_addr);
  
  
--- 498,502 ----
   
    /* Main addr */
!   COPY_IP(&net_msg->main_addr, &olsr_cnf->main_addr);
  
  

Index: main.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/main.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** main.c	29 Sep 2005 05:53:34 -0000	1.83
--- main.c	7 Jan 2006 08:16:20 -0000	1.84
***************
*** 55,58 ****
--- 55,59 ----
  #include "apm.h"
  #include "net_os.h"
+ #include "build_msg.h"
  
  #ifdef WIN32
***************
*** 77,83 ****
  print_usage(void);
  
- static void
- set_default_values(void);
- 
  static int
  set_default_ifcnfs(struct olsr_if *, struct if_config_options *);
--- 78,81 ----
***************
*** 115,121 ****
  
  #ifndef WIN32
-   /* Initialize tick resolution */
-   system_tick_divider = 1000/sysconf(_SC_CLK_TCK);
- 
    /* Check if user is root */
    if(getuid() || getgid())
--- 113,116 ----
***************
*** 125,130 ****
      }
  #else
-   system_tick_divider = 1;
- 
    DisableIcmpRedirects();
  
--- 120,123 ----
***************
*** 142,148 ****
    olsr_openlog("olsrd");
  
-   /* Set default values */
-   set_default_values();
-  
    /* Get initial timestep */
    nowtm = NULL;
--- 135,138 ----
***************
*** 152,158 ****
      }
      
-   /* The port to use for OLSR traffic */
-   olsr_udp_port = htons(OLSRPORT);
-     
    printf("\n *** %s ***\n Build date: %s\n http://www.olsr.org\n\n", 
  	 SOFTWARE_VERSION, 
--- 142,145 ----
***************
*** 220,223 ****
--- 207,217 ----
      }
  
+   /* Initialize tick resolution */
+ #ifndef WIN32
+   olsr_cnf->system_tick_divider = 1000/sysconf(_SC_CLK_TCK);
+ #else
+   olsr_cnf->system_tick_divider = 1;
+ #endif
+ 
    /*
     * Process olsrd options.
***************
*** 258,262 ****
     *socket for icotl calls
     */
!   if ((ioctl_s = socket(olsr_cnf->ip_version, SOCK_DGRAM, 0)) < 0) 
  
      {
--- 252,256 ----
     *socket for icotl calls
     */
!   if ((olsr_cnf->ioctl_s = socket(olsr_cnf->ip_version, SOCK_DGRAM, 0)) < 0) 
  
      {
***************
*** 266,270 ****
  
  #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
!   if ((rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
      {
        olsr_syslog(OLSR_LOG_ERR, "routing socket: %m");
--- 260,264 ----
  
  #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
!   if ((olsr_cnf->rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
      {
        olsr_syslog(OLSR_LOG_ERR, "routing socket: %m");
***************
*** 273,276 ****
--- 267,273 ----
  #endif
  
+   /* Init empty TC timer */
+   set_empty_tc_timer(GET_TIMESTAMP(0));
+ 
    /*
     *enable ip forwarding on host
***************
*** 305,324 ****
  	  olsr_cnf->willingness = olsr_calculate_willingness();
  
! 	  OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, will_int)
  	}
      }
  
!   /* Set ipsize and minimum packetsize */
    if(olsr_cnf->ip_version == AF_INET6)
      {
        OLSR_PRINTF(1, "Using IP version 6\n")
!       ipsize = sizeof(struct in6_addr);
!       minsize = (int)sizeof(olsr_u8_t) * 7; /* Minimum packetsize IPv6 */
      }
    else
      {
        OLSR_PRINTF(1, "Using IP version 4\n")
!       ipsize = sizeof(olsr_u32_t);
!       minsize = (int)sizeof(olsr_u8_t) * 4; /* Minimum packetsize IPv4 */
      }
  
--- 302,319 ----
  	  olsr_cnf->willingness = olsr_calculate_willingness();
  
! 	  OLSR_PRINTF(1, "Willingness set to %d - next update in %.1f secs\n", olsr_cnf->willingness, olsr_cnf->will_int)
  	}
      }
  
!   /* Set ipsize */
    if(olsr_cnf->ip_version == AF_INET6)
      {
        OLSR_PRINTF(1, "Using IP version 6\n")
!       olsr_cnf->ipsize = sizeof(struct in6_addr);
      }
    else
      {
        OLSR_PRINTF(1, "Using IP version 4\n")
!       olsr_cnf->ipsize = sizeof(olsr_u32_t);
      }
  
***************
*** 375,379 ****
    olsr_load_plugins();
  
!   OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&main_addr))
  
    /* Start syslog entry */
--- 370,374 ----
    olsr_load_plugins();
  
!   OLSR_PRINTF(1, "Main address: %s\n\n", olsr_ip_to_string(&olsr_cnf->main_addr))
  
    /* Start syslog entry */
***************
*** 481,489 ****
  
    /* ioctl socket */
!   close(ioctl_s);
  
  #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
    /* routing socket */
!   close(rts);
  #endif
  
--- 476,484 ----
  
    /* ioctl socket */
!   close(olsr_cnf->ioctl_s);
  
  #if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__ || defined __OpenBSD__
    /* routing socket */
!   close(olsr_cnf->rts);
  #endif
  
***************
*** 492,522 ****
    OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n           http://www.olsr.org\n", SOFTWARE_VERSION)
  
!   exit(exit_value);
! }
! 
! 
! 
! 
! 
! /**
!  *Sets the default values of variables at startup
!  *
!  */
! static void
! set_default_values()
! {
!   exit_value = EXIT_SUCCESS; 
!   /* If the application exits by signal it is concidered success,
!    * if not, exit_value is set by the function calling olsr_exit.
!    */
! 
!   will_int = 10 * HELLO_INTERVAL; /* Willingness update interval */
! 
!   /* Initialize empty TC timer */
!   send_empty_tc = GET_TIMESTAMP(0);
  }
  
- 
- 
  /**
   * Print the command line usage
--- 487,493 ----
    OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n           http://www.olsr.org\n", SOFTWARE_VERSION)
  
!   exit(olsr_cnf->exit_value);
  }
  
  /**
   * Print the command line usage
***************
*** 741,745 ****
        if (strcmp(*argv, "-dispin") == 0) 
  	{
! 	  disp_pack_in = OLSR_TRUE;
  	  continue;
  	}
--- 712,716 ----
        if (strcmp(*argv, "-dispin") == 0) 
  	{
! 	  parser_set_disp_pack_in(OLSR_TRUE);
  	  continue;
  	}
***************
*** 750,754 ****
        if (strcmp(*argv, "-dispout") == 0) 
  	{
! 	  disp_pack_out = OLSR_TRUE;
  	  continue;
  	}
--- 721,725 ----
        if (strcmp(*argv, "-dispout") == 0) 
  	{
! 	  net_set_disp_pack_out(OLSR_TRUE);
  	  continue;
  	}
***************
*** 820,824 ****
        if (strcmp(*argv, "-delgw") == 0) 
  	{
! 	  del_gws = OLSR_TRUE;
  	  continue;
  	}
--- 791,795 ----
        if (strcmp(*argv, "-delgw") == 0) 
  	{
! 	  olsr_cnf->del_gws = OLSR_TRUE;
  	  continue;
  	}

Index: olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** olsr.c	17 Nov 2005 04:25:44 -0000	1.47
--- olsr.c	7 Jan 2006 08:16:20 -0000	1.48
***************
*** 428,434 ****
    /* Set timer */
    jitter = (float) random()/RAND_MAX;
!   jitter *= max_jitter;
  
!   fwdtimer[ifn->if_nr] = GET_TIMESTAMP(jitter*1000);
  
  }
--- 428,434 ----
    /* Set timer */
    jitter = (float) random()/RAND_MAX;
!   jitter *= olsr_cnf->max_jitter;
  
!   ifn->fwdtimer = GET_TIMESTAMP(jitter*1000);
  
  }
***************
*** 441,445 ****
    if(olsr_cnf->willingness_auto)
      olsr_register_scheduler_event(&olsr_update_willingness, 
! 				  NULL, will_int, will_int, NULL);
  }
  
--- 441,445 ----
    if(olsr_cnf->willingness_auto)
      olsr_register_scheduler_event(&olsr_update_willingness, 
! 				  NULL, olsr_cnf->will_int, olsr_cnf->will_int, NULL);
  }
  
***************
*** 585,589 ****
    olsr_syslog(OLSR_LOG_ERR, "olsrd exit: %s\n", msg);
    fflush(stdout);
!   exit_value = val;
  
    raise(SIGTERM);
--- 585,589 ----
    olsr_syslog(OLSR_LOG_ERR, "olsrd exit: %s\n", msg);
    fflush(stdout);
!   olsr_cnf->exit_value = val;
  
    raise(SIGTERM);

Index: build_msg.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/build_msg.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** build_msg.h	2 Feb 2005 19:59:18 -0000	1.12
--- build_msg.h	7 Jan 2006 08:16:20 -0000	1.13
***************
*** 45,48 ****
--- 45,55 ----
  #include "packet.h"
  #include "olsr_protocol.h"
+ #include <time.h> /* For clock_t */
+ 
+ void
+ set_empty_tc_timer(clock_t);
+ 
+ clock_t
+ get_empty_tc_timer(void);
  
  olsr_bool

Index: mpr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** mpr.c	27 Feb 2005 10:43:38 -0000	1.14
--- mpr.c	7 Jan 2006 08:16:20 -0000	1.15
***************
*** 45,48 ****
--- 45,49 ----
  #include "olsr.h"
  #include "neighbor_table.h"
+ #include "scheduler.h"
  
  /* Begin:
***************
*** 542,546 ****
        OLSR_PRINTF(3, "CHANGES IN MPR SET\n")
        if(olsr_cnf->tc_redundancy > 0)
! 	changes = OLSR_TRUE;
      }
  
--- 543,547 ----
        OLSR_PRINTF(3, "CHANGES IN MPR SET\n")
        if(olsr_cnf->tc_redundancy > 0)
! 	signal_link_changes(OLSR_TRUE);
      }
  

Index: olsr_cfg.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr_cfg.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** olsr_cfg.h	4 Jan 2006 19:05:03 -0000	1.28
--- olsr_cfg.h	7 Jan 2006 08:16:20 -0000	1.29
***************
*** 220,223 ****
--- 220,236 ----
    struct olsr_if           *interfaces;
    olsr_u16_t               ifcnt;
+ 
+   /* Stuff set by olsrd */
+   size_t                   ipsize;               /* Size of address */
+   olsr_u16_t               system_tick_divider;  /* Tick resolution */
+   olsr_bool                del_gws;              /* Delete InternetGWs at startup */
+   union olsr_ip_addr       main_addr;            /* Main address of this node */
+   float                    will_int;
+   float                    max_jitter;
+   int                      exit_value; /* Global return value for process termination */
+   float                    max_tc_vtime;
+ 
+   int                      ioctl_s;              /* Socket used for ioctl calls */
+   int                      rts;                  /* Socket used for route changes on BSDs */
  };
  

Index: lq_mpr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_mpr.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** lq_mpr.c	29 Nov 2005 18:37:58 -0000	1.10
--- lq_mpr.c	7 Jan 2006 08:16:20 -0000	1.11
***************
*** 45,48 ****
--- 45,49 ----
  #include "link_set.h"
  #include "lq_mpr.h"
+ #include "scheduler.h"
  
  void olsr_calculate_lq_mpr(void)
***************
*** 177,180 ****
  
    if (mpr_changes && olsr_cnf->tc_redundancy > 0)
!     changes = OLSR_TRUE;
  }
--- 178,181 ----
  
    if (mpr_changes && olsr_cnf->tc_redundancy > 0)
!     signal_link_changes(OLSR_TRUE);
  }

Index: tc_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** tc_set.c	17 Nov 2005 04:25:44 -0000	1.23
--- tc_set.c	7 Jan 2006 08:16:20 -0000	1.24
***************
*** 60,65 ****
    int index;
   
-   changes = OLSR_FALSE;
- 
    OLSR_PRINTF(5, "TC: init topo\n")
  
--- 60,63 ----

Index: mpr_selector_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/mpr_selector_set.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** mpr_selector_set.c	16 Dec 2005 08:21:59 -0000	1.14
--- mpr_selector_set.c	7 Jan 2006 08:16:20 -0000	1.15
***************
*** 187,191 ****
        olsr_add_mpr_selector(addr, vtime);
        retval = 1;
!       changes = OLSR_TRUE;
      }
    else
--- 187,191 ----
        olsr_add_mpr_selector(addr, vtime);
        retval = 1;
!       signal_link_changes(OLSR_TRUE);
      }
    else
***************
*** 227,231 ****
  	  /* Delete entry */
  	  free(mprs_to_delete);
! 	  changes = OLSR_TRUE;
  	}
        else
--- 227,231 ----
  	  /* Delete entry */
  	  free(mprs_to_delete);
! 	  signal_link_changes(OLSR_TRUE);
  	}
        else

Index: parser.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** parser.c	19 Nov 2005 08:49:44 -0000	1.29
--- parser.c	7 Jan 2006 08:16:20 -0000	1.30
***************
*** 66,69 ****
--- 66,77 ----
  static char inbuf[MAXMESSAGESIZE+1];
  
+ static olsr_bool disp_pack_in = OLSR_FALSE;
+ 
+ void
+ parser_set_disp_pack_in(olsr_bool val)
+ {
+   disp_pack_in = val;
+ }
+ 
  /**
   *Initialize the parser. 
***************
*** 161,165 ****
    count = size - ((char *)m - (char *)olsr);
  
!   if (count < minsize)
      return;
  
--- 169,173 ----
    count = size - ((char *)m - (char *)olsr);
  
!   if (count < MIN_PACKET_SIZE(olsr_cnf->ip_version))
      return;
  
***************
*** 216,220 ****
  
        processed = 0;      
!       if (count < minsize)
  	break;
        
--- 224,228 ----
  
        processed = 0;      
!       if (count < MIN_PACKET_SIZE(olsr_cnf->ip_version))
  	break;
        
***************
*** 271,275 ****
  
        /* Should be the same for IPv4 and IPv6 */
!       if(COMP_IP(&m->v4.originator, &main_addr))
  	{
  #ifdef DEBUG
--- 279,283 ----
  
        /* Should be the same for IPv4 and IPv6 */
!       if(COMP_IP(&m->v4.originator, &olsr_cnf->main_addr))
  	{
  #ifdef DEBUG
***************
*** 311,315 ****
  
  	  /* Forward message */
! 	  if(!COMP_IP(&unkpacket.originator, &main_addr))
  	    {	      
  	      /* Forward */
--- 319,323 ----
  
  	  /* Forward message */
! 	  if(!COMP_IP(&unkpacket.originator, &olsr_cnf->main_addr))
  	    {	      
  	      /* Forward */
***************
*** 441,445 ****
       direct link */
  
!   if((cc = recv(fd, from_addr.v6.s6_addr, ipsize, 0)) != (int)ipsize)
      {
        fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno));
--- 449,453 ----
       direct link */
  
!   if((cc = recv(fd, from_addr.v6.s6_addr, olsr_cnf->ipsize, 0)) != (int)olsr_cnf->ipsize)
      {
        fprintf(stderr, "Error receiving host-client IP hook(%d) %s!\n", cc, strerror(errno));

Index: scheduler.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** scheduler.c	29 Dec 2005 22:34:37 -0000	1.33
--- scheduler.c	7 Jan 2006 08:16:20 -0000	1.34
***************
*** 64,69 ****
  static struct event_entry *event_functions;
  
  
! static void trigger_dijkstra(void *dummy)
  {
    OLSR_PRINTF(3, "Triggering Dijkstra\n");
--- 64,77 ----
  static struct event_entry *event_functions;
  
+ static olsr_bool link_changes; /* is set if changes occur in MPRS set */ 
  
! void
! signal_link_changes(olsr_bool val)
! {
!   link_changes = val;
! }
! 
! static void 
! trigger_dijkstra(void *dummy)
  {
    OLSR_PRINTF(3, "Triggering Dijkstra\n");
***************
*** 108,111 ****
--- 116,121 ----
    struct tms tms_buf;
   
+   link_changes = OLSR_FALSE;
+ 
    if(olsr_cnf->lq_level > 1 && olsr_cnf->lq_dinter > 0.0)
      olsr_register_scheduler_event(trigger_dijkstra, NULL, olsr_cnf->lq_dinter, 0, NULL);
***************
*** 118,122 ****
  
    OLSR_PRINTF(1, "Scheduler started - polling every %0.2f seconds\n", pollrate)
!   OLSR_PRINTF(3, "Max jitter is %f\n\n", max_jitter)
  
    /* Main scheduler event loop */
--- 128,132 ----
  
    OLSR_PRINTF(1, "Scheduler started - polling every %0.2f seconds\n", pollrate)
!   OLSR_PRINTF(3, "Max jitter is %f\n\n", olsr_cnf->max_jitter)
  
    /* Main scheduler event loop */
***************
*** 153,161 ****
  
        /* Check for changes in topology */
!       if(changes)
          {
  	  OLSR_PRINTF(3, "ANSN UPDATED %d\n\n", get_local_ansn())
  	  increase_local_ansn();
!           changes = OLSR_FALSE;
  	}
  
--- 163,171 ----
  
        /* Check for changes in topology */
!       if(link_changes)
          {
  	  OLSR_PRINTF(3, "ANSN UPDATED %d\n\n", get_local_ansn())
  	  increase_local_ansn();
!           link_changes = OLSR_FALSE;
  	}
  
***************
*** 180,184 ****
  	      /* Set jitter */
  	      entry->since_last = (float) random()/RAND_MAX;
! 	      entry->since_last *= max_jitter;
  	      
  	      /* Reset trigger */
--- 190,194 ----
  	      /* Set jitter */
  	      entry->since_last = (float) random()/RAND_MAX;
! 	      entry->since_last *= olsr_cnf->max_jitter;
  	      
  	      /* Reset trigger */
***************
*** 198,202 ****
        for (ifn = ifnet; ifn ; ifn = ifn->int_next) 
  	{ 
! 	  if(net_output_pending(ifn) && TIMED_OUT(fwdtimer[ifn->if_nr])) 
  	    net_output(ifn);
  	}
--- 208,212 ----
        for (ifn = ifnet; ifn ; ifn = ifn->int_next) 
  	{ 
! 	  if(net_output_pending(ifn) && TIMED_OUT(ifn->fwdtimer)) 
  	    net_output(ifn);
  	}
***************
*** 206,211 ****
  
        //printf("Tick diff: %d\n", end_of_loop - now_times);
!       time_used.tv_sec = ((end_of_loop - now_times) * system_tick_divider) / 1000;
!       time_used.tv_usec = ((end_of_loop - now_times) * system_tick_divider) % 1000;
  
        //printf("Time used: %d.%04d\n", time_used.tv_sec, time_used.tv_usec);
--- 216,221 ----
  
        //printf("Tick diff: %d\n", end_of_loop - now_times);
!       time_used.tv_sec = ((end_of_loop - now_times) * olsr_cnf->system_tick_divider) / 1000;
!       time_used.tv_usec = ((end_of_loop - now_times) * olsr_cnf->system_tick_divider) % 1000;
  
        //printf("Time used: %d.%04d\n", time_used.tv_sec, time_used.tv_usec);

Index: scheduler.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/scheduler.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** scheduler.h	6 Mar 2005 19:33:35 -0000	1.11
--- scheduler.h	7 Jan 2006 08:16:20 -0000	1.12
***************
*** 69,72 ****
--- 69,75 ----
  };
  
+ void
+ signal_link_changes(olsr_bool);
+ 
  int
  olsr_register_timeout_function(void (*)(void));

Index: parser.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** parser.h	30 May 2005 13:13:38 -0000	1.10
--- parser.h	7 Jan 2006 08:16:20 -0000	1.11
***************
*** 61,64 ****
--- 61,67 ----
  
  void
+ parser_set_disp_pack_in(olsr_bool);
+ 
+ void
  olsr_init_parser(void);
  





More information about the Olsr-cvs mailing list