[Olsr-cvs] olsrd-current/src/unix ifnet.c,1.31,1.32

Andreas T�nnesen (spam-protected)
Fri Jan 6 07:54:06 CET 2006


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

Modified Files:
	ifnet.c 
Log Message:
Initial libnet code for testing. Works on Linux now, do make USE_LIBNET=1 to use

Index: ifnet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** ifnet.c	29 Dec 2005 18:37:16 -0000	1.31
--- ifnet.c	6 Jan 2006 06:54:04 -0000	1.32
***************
*** 50,53 ****
--- 50,54 ----
  #include "olsr.h"
  #include "net_os.h"
+ #include "net_olsr.h"
  #include "socket_parser.h"
  #include "parser.h"
***************
*** 67,70 ****
--- 68,75 ----
  #include <unistd.h>
  
+ #ifdef USE_LIBNET
+ #include <libnet.h>
+ #endif
+ 
  int bufspace = 127*1024;	/* max. input buffer size to request */
  
***************
*** 485,488 ****
--- 490,497 ----
    close(ifp->olsr_socket);
    remove_olsr_socket(ifp->olsr_socket, &olsr_input);
+ #ifdef USE_LIBNET
+   libnet_destroy(ifp->libnet_ctx);
+ #endif
+ 
    /* Free memory */
    free(ifp->int_name);
***************
*** 919,922 ****
--- 928,945 ----
  	  kill(getpid(), SIGINT);
  	}
+ 
+ #ifdef USE_LIBNET
+       ifp->libnet_ctx = libnet_init(LIBNET_RAW4, ifp->int_name, get_libnet_errbuf());
+ 
+       if(ifp->libnet_ctx == NULL)
+ 	{
+ 	  fprintf(stderr, "Could not initialize libnet... exiting!\n\n");
+ 	  olsr_syslog(OLSR_LOG_ERR, "Could not initialize libnet... exiting!\n\n");
+ 	  exit_value = EXIT_FAILURE;
+ 	  kill(getpid(), SIGINT);
+ 	}
+ #else
+       ifp->libnet_ctx = NULL;
+ #endif
      }
    else





More information about the Olsr-cvs mailing list