[Olsr-cvs] olsrd-current/src/win32 compat.c, 1.16, 1.17 ifnet.c, 1.39, 1.40 kernel_routes.c, 1.23, 1.24 net.c, 1.22, 1.23

Bernd Petrovitsch (spam-protected)
Fri Nov 9 00:23:15 CET 2007


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

Modified Files:
	compat.c ifnet.c kernel_routes.c net.c 
Log Message:
 * and make it compile on Win32

Index: ifnet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/ifnet.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** ifnet.c	8 Nov 2007 22:47:43 -0000	1.39
--- ifnet.c	8 Nov 2007 23:23:13 -0000	1.40
***************
*** 51,58 ****
--- 51,61 ----
  #include "mantissa.h"
  #include "lq_packet.h"
+ #include "net_olsr.h"
  
  #include <iphlpapi.h>
  #include <iprtrmib.h>
  
+ #include <arpa/inet.h>
+ 
  struct MibIpInterfaceRow
  {
***************
*** 545,550 ****
      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));
      }
    }
--- 548,555 ----
      else
      {
!       struct ipaddr_str buf;
!       //COPY_IP(&olsr_cnf->main_addr, &ifnet->ip_addr);
!       olsr_cnf->main_addr = ifnet->ip_addr;
!       OLSR_PRINTF(1, "New main address: %s.\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
      }
    }
***************
*** 604,607 ****
--- 609,613 ----
    union olsr_ip_addr null_addr;
    olsr_u32_t addr[4];
+   struct ipaddr_str buf;
  
    if(!iface->host_emul)
***************
*** 623,627 ****
    OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name);
  
!   OLSR_PRINTF(1, "       Address:%s\n", olsr_ip_to_string(&iface->hemu_ip));
  
    OLSR_PRINTF(1, "       NB! This is a emulated interface\n       that does not exist in the kernel!\n");
--- 629,633 ----
    OLSR_PRINTF(1, "Adding %s(host emulation):\n", ifp->int_name);
  
!   OLSR_PRINTF(1, "       Address:%s\n", olsr_ip_to_string(&buf, &iface->hemu_ip));
  
    OLSR_PRINTF(1, "       NB! This is a emulated interface\n       that does not exist in the kernel!\n");
***************
*** 633,638 ****
    if(ipequal(&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));
      }
  
--- 639,645 ----
    if(ipequal(&null_addr, &olsr_cnf->main_addr))
      {
!       //COPY_IP(&olsr_cnf->main_addr, &iface->hemu_ip);
!       olsr_cnf->main_addr = iface->hemu_ip;
!       OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
      }
  
***************
*** 777,780 ****
--- 784,788 ----
  int chk_if_changed(struct olsr_if *IntConf)
  {
+   struct ipaddr_str buf;
    struct interface *Int;
    struct InterfaceInfo Info;
***************
*** 837,852 ****
    }
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_addr)->sin_addr.s_addr;
!   NewVal.v4 = Info.Addr;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tAddress: %s\n", olsr_ip_to_string(&NewVal));
  #endif
  
!   if (NewVal.v4 != OldVal.v4)
    {
      OLSR_PRINTF(1, "\tAddress change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal));
  
      Int->ip_addr.v4 = NewVal.v4;
--- 845,860 ----
    }
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_addr)->sin_addr;
!   NewVal.v4.s_addr = Info.Addr;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tAddress: %s\n", olsr_ip_to_string(&buf, &NewVal));
  #endif
  
!   if (NewVal.v4.s_addr != OldVal.v4.s_addr)
    {
      OLSR_PRINTF(1, "\tAddress change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal));
  
      Int->ip_addr.v4 = NewVal.v4;
***************
*** 856,862 ****
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr.s_addr = NewVal.v4;
  
!     if (olsr_cnf->main_addr.v4 == OldVal.v4)
      {
        OLSR_PRINTF(1, "\tMain address change.\n");
--- 864,870 ----
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr = NewVal.v4;
  
!     if (olsr_cnf->main_addr.v4.s_addr == OldVal.v4.s_addr)
      {
        OLSR_PRINTF(1, "\tMain address change.\n");
***************
*** 871,886 ****
      OLSR_PRINTF(3, "\tNo address change.\n");
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_netmask)->sin_addr.s_addr;
!   NewVal.v4 = Info.Mask;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tNetmask: %s\n", olsr_ip_to_string(&NewVal));
  #endif
  
!   if (NewVal.v4 != OldVal.v4)
    {
      OLSR_PRINTF(1, "\tNetmask change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal));
  
      AddrIn = (struct sockaddr_in *)&Int->int_netmask;
--- 879,894 ----
      OLSR_PRINTF(3, "\tNo address change.\n");
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_netmask)->sin_addr;
!   NewVal.v4.s_addr = Info.Mask;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tNetmask: %s\n", olsr_ip_to_string(&buf, &NewVal));
  #endif
  
!   if (NewVal.v4.s_addr != OldVal.v4.s_addr)
    {
      OLSR_PRINTF(1, "\tNetmask change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal));
  
      AddrIn = (struct sockaddr_in *)&Int->int_netmask;
***************
*** 888,892 ****
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr.s_addr = NewVal.v4;
  
      Res = 1;
--- 896,900 ----
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr = NewVal.v4;
  
      Res = 1;
***************
*** 896,911 ****
      OLSR_PRINTF(3, "\tNo netmask change.\n");
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_broadaddr)->sin_addr.s_addr;
!   NewVal.v4 = Info.Broad;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tBroadcast address: %s\n", olsr_ip_to_string(&NewVal));
  #endif
  
!   if (NewVal.v4 != OldVal.v4)
    {
      OLSR_PRINTF(1, "\tBroadcast address change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&NewVal));
  
      AddrIn = (struct sockaddr_in *)&Int->int_broadaddr;
--- 904,919 ----
      OLSR_PRINTF(3, "\tNo netmask change.\n");
  
!   OldVal.v4 = ((struct sockaddr_in *)&Int->int_broadaddr)->sin_addr;
!   NewVal.v4.s_addr = Info.Broad;
  
  #ifdef DEBUG
!   OLSR_PRINTF(3, "\tBroadcast address: %s\n", olsr_ip_to_string(&buf, &NewVal));
  #endif
  
!   if (NewVal.v4.s_addr != OldVal.v4.s_addr)
    {
      OLSR_PRINTF(1, "\tBroadcast address change.\n");
!     OLSR_PRINTF(1, "\tOld: %s\n", olsr_ip_to_string(&buf, &OldVal));
!     OLSR_PRINTF(1, "\tNew: %s\n", olsr_ip_to_string(&buf, &NewVal));
  
      AddrIn = (struct sockaddr_in *)&Int->int_broadaddr;
***************
*** 913,917 ****
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr.s_addr = NewVal.v4;
  
      Res = 1;
--- 921,925 ----
      AddrIn->sin_family = AF_INET;
      AddrIn->sin_port = 0;
!     AddrIn->sin_addr = NewVal.v4;
  
      Res = 1;
***************
*** 929,932 ****
--- 937,941 ----
  int chk_if_up(struct olsr_if *IntConf, int DebugLevel __attribute__((unused)))
  {
+   struct ipaddr_str buf;
    struct InterfaceInfo Info;
    struct interface *New;
***************
*** 966,971 ****
    AddrIn->sin_addr.s_addr = Info.Broad;
  
!   if (IntConf->cnf->ipv4_broadcast.v4 != 0)
!     AddrIn->sin_addr.s_addr = IntConf->cnf->ipv4_broadcast.v4;
  
    New->int_flags = 0;
--- 975,980 ----
    AddrIn->sin_addr.s_addr = Info.Broad;
  
!   if (IntConf->cnf->ipv4_broadcast.v4.s_addr != 0)
!     AddrIn->sin_addr = IntConf->cnf->ipv4_broadcast.v4;
  
    New->int_flags = 0;
***************
*** 999,1009 ****
        
    OLSR_PRINTF(1, "\tMTU: %d\n", New->int_mtu);
!   OLSR_PRINTF(1, "\tAddress: %s\n", sockaddr_to_string(&New->int_addr));
!   OLSR_PRINTF(1, "\tNetmask: %s\n", sockaddr_to_string(&New->int_netmask));
!   OLSR_PRINTF(1, "\tBroadcast address: %s\n",
!               sockaddr_to_string(&New->int_broadaddr));
  
!   New->ip_addr.v4 =
!     ((struct sockaddr_in *)&New->int_addr)->sin_addr.s_addr;
        
    New->if_index = Info.Index;
--- 1008,1016 ----
        
    OLSR_PRINTF(1, "\tMTU: %d\n", New->int_mtu);
!   OLSR_PRINTF(1, "\tAddress: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_addr));
!   OLSR_PRINTF(1, "\tNetmask: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_netmask));
!   OLSR_PRINTF(1, "\tBroadcast address: %s\n", sockaddr_to_string(&buf, (const struct sockaddr*)&New->int_broadaddr));
  
!   New->ip_addr.v4 = New->int_addr.sin_addr;
        
    New->if_index = Info.Index;
***************
*** 1012,1016 ****
  
    AddrSockAddr = addrsock.sin_addr.s_addr;
!   addrsock.sin_addr.s_addr = New->ip_addr.v4;
  
    New->olsr_socket = getsocket((struct sockaddr *)&addrsock,
--- 1019,1023 ----
  
    AddrSockAddr = addrsock.sin_addr.s_addr;
!   addrsock.sin_addr = New->ip_addr.v4;
  
    New->olsr_socket = getsocket((struct sockaddr *)&addrsock,
***************
*** 1037,1042 ****
    if(ipequal(&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));
    }
  
--- 1044,1050 ----
    if(ipequal(&NullAddr, &olsr_cnf->main_addr))
    {
!     //COPY_IP(&olsr_cnf->main_addr, &New->ip_addr);
!     olsr_cnf->main_addr = New->ip_addr;
!     OLSR_PRINTF(1, "New main address: %s\n", olsr_ip_to_string(&buf, &olsr_cnf->main_addr));
    }
  

Index: net.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/net.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** net.c	25 Apr 2007 22:24:09 -0000	1.22
--- net.c	8 Nov 2007 23:23:13 -0000	1.23
***************
*** 55,58 ****
--- 55,59 ----
  #include "defs.h"
  #include "net_os.h"
+ #include "net_olsr.h"
  
  #if defined WINCE
***************
*** 338,348 ****
  {
    /* See linux/in6.h */
! 
    struct ipv6_mreq McastReq;
  
!   COPY_IP(&McastReq.ipv6mr_multiaddr, &Nic->int6_multaddr.sin6_addr);
    McastReq.ipv6mr_interface = Nic->if_index;
  
!   OLSR_PRINTF(3, "Interface %s joining multicast %s...", Nic->int_name, olsr_ip_to_string((union olsr_ip_addr *)&Nic->int6_multaddr.sin6_addr));
    /* Send multicast */
    if(setsockopt(Sock, 
--- 339,350 ----
  {
    /* See linux/in6.h */
!   struct ipaddr_str buf;
    struct ipv6_mreq McastReq;
  
!   //COPY_IP(&McastReq.ipv6mr_multiaddr, &Nic->int6_multaddr.sin6_addr);
!   McastReq.ipv6mr_multiaddr = Nic->int6_multaddr.sin6_addr;
    McastReq.ipv6mr_interface = Nic->if_index;
  
!   OLSR_PRINTF(3, "Interface %s joining multicast %s...", Nic->int_name, olsr_ip_to_string(&buf, (union olsr_ip_addr *)&Nic->int6_multaddr.sin6_addr));
    /* Send multicast */
    if(setsockopt(Sock, 

Index: kernel_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/kernel_routes.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** kernel_routes.c	5 Sep 2007 22:17:26 -0000	1.23
--- kernel_routes.c	8 Nov 2007 23:23:13 -0000	1.24
***************
*** 44,48 ****
  
  #include "kernel_routes.h"
! #include "defs.h"
  
  #define WIN32_LEAN_AND_MEAN
--- 44,49 ----
  
  #include "kernel_routes.h"
! #include "net_olsr.h"
! #include "ipc_frontend.h"
  
  #define WIN32_LEAN_AND_MEAN
***************
*** 70,86 ****
    memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
  
!   Row.dwForwardDest = rt->rt_dst.prefix.v4;
  
    if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
      return -1;
    } else {
!       Row.dwForwardMask = mask.v4;
    }
  
    Row.dwForwardPolicy = 0;
!   Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4;
    Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iif_index;
    // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
!   Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_best->rtp_nexthop.gateway.v4) ? 3 : 4;
    Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
    Row.dwForwardAge = INFINITE;
--- 71,87 ----
    memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
  
!   Row.dwForwardDest = rt->rt_dst.prefix.v4.s_addr;
  
    if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
      return -1;
    } else {
!       Row.dwForwardMask = mask.v4.s_addr;
    }
  
    Row.dwForwardPolicy = 0;
!   Row.dwForwardNextHop = rt->rt_best->rtp_nexthop.gateway.v4.s_addr;
    Row.dwForwardIfIndex = rt->rt_best->rtp_nexthop.iif_index;
    // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
!   Row.dwForwardType = (rt->rt_dst.prefix.v4.s_addr == rt->rt_best->rtp_nexthop.gateway.v4.s_addr) ? 3 : 4;
    Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
    Row.dwForwardAge = INFINITE;
***************
*** 147,165 ****
    OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
  
!   memset(&Row, 0, sizeof (MIB_IPFORWARDROW));
  
!   Row.dwForwardDest = rt->rt_dst.prefix.v4;
  
    if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
      return -1;
-   } else {
-       Row.dwForwardMask = mask.v4;
    }
! 
    Row.dwForwardPolicy = 0;
!   Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4;
    Row.dwForwardIfIndex = rt->rt_nexthop.iif_index;
    // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
!   Row.dwForwardType = (rt->rt_dst.prefix.v4 == rt->rt_nexthop.gateway.v4) ? 3 : 4;
    Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
    Row.dwForwardAge = INFINITE;
--- 148,164 ----
    OLSR_PRINTF(2, "KERN: Deleting %s\n", olsr_rt_to_string(rt));
  
!   memset(&Row, 0, sizeof (Row));
  
!   Row.dwForwardDest = rt->rt_dst.prefix.v4.s_addr;
  
    if (!olsr_prefix_to_netmask(&mask, rt->rt_dst.prefix_len)) {
      return -1;
    }
!   Row.dwForwardMask = mask.v4.s_addr;
    Row.dwForwardPolicy = 0;
!   Row.dwForwardNextHop = rt->rt_nexthop.gateway.v4.s_addr;
    Row.dwForwardIfIndex = rt->rt_nexthop.iif_index;
    // MIB_IPROUTE_TYPE_DIRECT and MIB_IPROUTE_TYPE_INDIRECT
!   Row.dwForwardType = (rt->rt_dst.prefix.v4.s_addr == rt->rt_nexthop.gateway.v4.s_addr) ? 3 : 4;
    Row.dwForwardProto = 3; // MIB_IPPROTO_NETMGMT
    Row.dwForwardAge = INFINITE;

Index: compat.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/compat.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** compat.c	15 Jul 2007 21:09:38 -0000	1.16
--- compat.c	8 Nov 2007 23:23:13 -0000	1.17
***************
*** 63,66 ****
--- 63,68 ----
  #include <dlfcn.h>
  #include <io.h>
+ #include <arpa/inet.h>
+ 
  #include "defs.h"
  





More information about the Olsr-cvs mailing list