[Olsr-cvs] olsrd-current/src/win32 net.c,1.24,1.25

Bernd Petrovitsch (spam-protected)
Thu Dec 6 22:12:57 CET 2007


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

Modified Files:
	net.c 
Log Message:
* removed the unused functions get_if_property_id(), add_if_geninfo(),
  get_if_geninfo(), del_if_geninfo()
* if_ifwithindex() is used only locally: made it "static"
* Simplified a little bit: addrsock and addrsock6 are defined and
  initialized in interfaces.c, used in src/*/net.c and passed as parameter
  to the functions getsocket{,6}() in src/*/ifnet.c.
  We now just define and initialize that locally.


Index: net.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/win32/net.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** net.c	29 Nov 2007 18:10:18 -0000	1.24
--- net.c	6 Dec 2007 21:12:55 -0000	1.25
***************
*** 99,110 ****
  }
  
! int getsocket(struct sockaddr *Addr, int BuffSize, char *Int __attribute__((unused)))
  {
!   int Sock;
    int On = 1;
    unsigned long Len;
! 
!   Sock = socket(AF_INET, SOCK_DGRAM, 0);
! 
    if (Sock < 0)
    {
--- 99,108 ----
  }
  
! int getsocket(int BuffSize, char *Int __attribute__((unused)))
  {
!   struct sockaddr_in Addr;
    int On = 1;
    unsigned long Len;
!   int Sock = socket(AF_INET, SOCK_DGRAM, 0);
    if (Sock < 0)
    {
***************
*** 133,137 ****
      fprintf(stderr, "Cannot set IPv4 socket receive buffer.\n");
  
!   if (bind(Sock, Addr, sizeof (struct sockaddr_in)) < 0)
    {
      WinSockPError("getsocket/bind()");
--- 131,139 ----
      fprintf(stderr, "Cannot set IPv4 socket receive buffer.\n");
  
!   memset(&Addr, 0, sizeof (Addr));
!   Addr.sin_family = AF_INET;
!   Addr.sin_port = htons(OLSRPORT);
!   Addr.sin_addr.s_addr = INADDR_ANY;
!   if (bind(Sock, (struct sockaddr *)&Addr, sizeof (Addr)) < 0)
    {
      WinSockPError("getsocket/bind()");
***************
*** 150,160 ****
  }
  
! int getsocket6(struct sockaddr_in6 *Addr, int BuffSize, char *Int __attribute__((unused)))
  {
!   int Sock;
    int On = 1;
! 
!   Sock = socket(AF_INET6, SOCK_DGRAM, 0);
! 
    if (Sock < 0)
    {
--- 152,160 ----
  }
  
! int getsocket6(int BuffSize, char *Int __attribute__((unused)))
  {
!   struct sockaddr_in6 Addr;
    int On = 1;
!   int Sock = socket(AF_INET6, SOCK_DGRAM, 0);
    if (Sock < 0)
    {
***************
*** 183,187 ****
      fprintf(stderr, "Cannot set IPv6 socket receive buffer.\n");
  
!   if (bind(Sock, (struct sockaddr *)Addr, sizeof (struct sockaddr_in6)) < 0)
    {
      WinSockPError("getsocket6/bind()");
--- 183,191 ----
      fprintf(stderr, "Cannot set IPv6 socket receive buffer.\n");
  
!   memset(&Addr6, 0, sizeof (Addr6));
!   Addr6.sin6_family = AF_INET6;
!   Addr6.sin6_port = htons(OLSRPORT);
!   //Addr6.sin6_addr.s_addr = IN6ADDR_ANY_INIT;
!   if (bind(Sock, (struct sockaddr *)&Addr, sizeof (Addr)) < 0)
    {
      WinSockPError("getsocket6/bind()");





More information about the Olsr-cvs mailing list