[Olsr-cvs] olsrd-current/src/win32 ifnet.c,1.29,1.30

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


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

Modified Files:
	ifnet.c 
Log Message:
Cleanup in use of extern variables. Rather trivial changes, but a lot of them

Index: ifnet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/ifnet.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** ifnet.c	23 Oct 2005 19:01:04 -0000	1.29
--- ifnet.c	7 Jan 2006 08:16:26 -0000	1.30
***************
*** 377,385 ****
    }
  
!   if(COMP_IP(&main_addr, &Int->ip_addr))
    {
      if(ifnet == NULL)
      {
!       memset(&main_addr, 0, ipsize);
        OLSR_PRINTF(1, "Removed last interface. Cleared main address.\n")
      }
--- 377,385 ----
    }
  
!   if(COMP_IP(&olsr_cnf->main_addr, &Int->ip_addr))
    {
      if(ifnet == NULL)
      {
!       memset(&olsr_cnf->main_addr, 0, olsr_cnf->ipsize);
        OLSR_PRINTF(1, "Removed last interface. Cleared main address.\n")
      }
***************
*** 387,392 ****
      else
      {
!       COPY_IP(&main_addr, &ifnet->ip_addr);
!       OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&main_addr))
      }
    }
--- 387,392 ----
      else
      {
!       COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr);
!       OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&olsr_cnf->main_addr))
      }
    }
***************
*** 436,440 ****
    {
      OLSR_PRINTF(1, "No more active interfaces - exiting.\n")
!     exit_value = EXIT_FAILURE;
      CallSignalHandler();
    }
--- 436,440 ----
    {
      OLSR_PRINTF(1, "No more active interfaces - exiting.\n")
!     olsr_cnf->exit_value = EXIT_FAILURE;
      CallSignalHandler();
    }
***************
*** 474,482 ****
    ifnet = ifp;
  
!   memset(&null_addr, 0, ipsize);
!   if(COMP_IP(&null_addr, &main_addr))
      {
!       COPY_IP(&main_addr, &iface->hemu_ip);
!       OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&main_addr))
      }
  
--- 474,482 ----
    ifnet = ifp;
  
!   memset(&null_addr, 0, olsr_cnf->ipsize);
!   if(COMP_IP(&null_addr, &olsr_cnf->main_addr))
      {
!       COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip);
!       OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr))
      }
  
***************
*** 506,510 ****
        ifp->ip_addr.v4 = iface->hemu_ip.v4;
  
!       memcpy(&((struct sockaddr_in *)&ifp->int_addr)->sin_addr, &iface->hemu_ip, ipsize);
        
        /*
--- 506,510 ----
        ifp->ip_addr.v4 = iface->hemu_ip.v4;
  
!       memcpy(&((struct sockaddr_in *)&ifp->int_addr)->sin_addr, &iface->hemu_ip, olsr_cnf->ipsize);
        
        /*
***************
*** 526,530 ****
      {
        /* IP version 6 */
!       memcpy(&ifp->ip_addr, &iface->hemu_ip, ipsize);
  
  #if 0      
--- 526,530 ----
      {
        /* IP version 6 */
!       memcpy(&ifp->ip_addr, &iface->hemu_ip, olsr_cnf->ipsize);
  
  #if 0      
***************
*** 549,553 ****
  
    /* Send IP as first 4/16 bytes on socket */
!   memcpy(addr, iface->hemu_ip.v6.s6_addr, ipsize);
    addr[0] = htonl(addr[0]);
    addr[1] = htonl(addr[1]);
--- 549,553 ----
  
    /* Send IP as first 4/16 bytes on socket */
!   memcpy(addr, iface->hemu_ip.v6.s6_addr, olsr_cnf->ipsize);
    addr[0] = htonl(addr[0]);
    addr[1] = htonl(addr[1]);
***************
*** 555,559 ****
    addr[3] = htonl(addr[3]);
  
!   if(send(ifp->olsr_socket, (char *)addr, ipsize, 0) != (int)ipsize)
      {
        fprintf(stderr, "Error sending IP!");
--- 555,559 ----
    addr[3] = htonl(addr[3]);
  
!   if(send(ifp->olsr_socket, (char *)addr, olsr_cnf->ipsize, 0) != (int)olsr_cnf->ipsize)
      {
        fprintf(stderr, "Error sending IP!");
***************
*** 605,614 ****
    /* Recalculate max jitter */
  
!   if((max_jitter == 0) || ((iface->cnf->hello_params.emission_interval / 4) < max_jitter))
!     max_jitter = iface->cnf->hello_params.emission_interval / 4;
  
    /* Recalculate max topology hold time */
!   if(max_tc_vtime < iface->cnf->tc_params.emission_interval)
!     max_tc_vtime = iface->cnf->tc_params.emission_interval;
  
    ifp->hello_etime = iface->cnf->hello_params.emission_interval;
--- 605,615 ----
    /* Recalculate max jitter */
  
!   if((olsr_cnf->max_jitter == 0) || 
!      ((iface->cnf->hello_params.emission_interval / 4) < olsr_cnf->max_jitter))
!     olsr_cnf->max_jitter = iface->cnf->hello_params.emission_interval / 4;
  
    /* Recalculate max topology hold time */
!   if(olsr_cnf->max_tc_vtime < iface->cnf->tc_params.emission_interval)
!     olsr_cnf->max_tc_vtime = iface->cnf->tc_params.emission_interval;
  
    ifp->hello_etime = iface->cnf->hello_params.emission_interval;
***************
*** 704,712 ****
      AddrIn->sin_addr.s_addr = NewVal.v4;
  
!     if (main_addr.v4 == OldVal.v4)
      {
        OLSR_PRINTF(1, "\tMain address change.\n")
  
!       main_addr.v4 = NewVal.v4;
      }
  
--- 705,713 ----
      AddrIn->sin_addr.s_addr = NewVal.v4;
  
!     if (olsr_cnf->main_addr.v4 == OldVal.v4)
      {
        OLSR_PRINTF(1, "\tMain address change.\n")
  
!       olsr_cnf->main_addr.v4 = NewVal.v4;
      }
  
***************
*** 879,888 ****
    IntConf->configured = 1;
  
!   memset(&NullAddr, 0, ipsize);
    
!   if(COMP_IP(&NullAddr, &main_addr))
    {
!     COPY_IP(&main_addr, &New->ip_addr);
!     OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&main_addr))
    }
  
--- 880,889 ----
    IntConf->configured = 1;
  
!   memset(&NullAddr, 0, olsr_cnf->ipsize);
    
!   if(COMP_IP(&NullAddr, &olsr_cnf->main_addr))
    {
!     COPY_IP(&olsr_cnf->main_addr, &New->ip_addr);
!     OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&olsr_cnf->main_addr))
    }
  
***************
*** 919,928 ****
                                  0, NULL);
  
!   if(max_jitter == 0 ||
!      IntConf->cnf->hello_params.emission_interval / 4 < max_jitter)
!     max_jitter = IntConf->cnf->hello_params.emission_interval / 4;
  
!   if(max_tc_vtime < IntConf->cnf->tc_params.emission_interval)
!     max_tc_vtime = IntConf->cnf->tc_params.emission_interval;
  
    New->hello_etime = IntConf->cnf->hello_params.emission_interval;
--- 920,929 ----
                                  0, NULL);
  
!   if(olsr_cnf->max_jitter == 0 ||
!      IntConf->cnf->hello_params.emission_interval / 4 < olsr_cnf->max_jitter)
!     olsr_cnf->max_jitter = IntConf->cnf->hello_params.emission_interval / 4;
  
!   if(olsr_cnf->max_tc_vtime < IntConf->cnf->tc_params.emission_interval)
!     olsr_cnf->max_tc_vtime = IntConf->cnf->tc_params.emission_interval;
  
    New->hello_etime = IntConf->cnf->hello_params.emission_interval;





More information about the Olsr-cvs mailing list