[Olsr-cvs] olsrd-current/src/linux net.c,1.31,1.32 net.h,1.7,1.8

Bernd Petrovitsch (spam-protected)
Mon Feb 5 00:36:37 CET 2007


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

Modified Files:
	net.c net.h 
Log Message:
* killed the MAX_IFS variable and another statically sized array

Index: net.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** net.c	5 Nov 2006 23:03:56 -0000	1.31
--- net.c	4 Feb 2007 23:36:35 -0000	1.32
***************
*** 58,61 ****
--- 58,65 ----
  #define SIOCGIWRATE	0x8B21		/* get default bit rate (bps) */
  
+ /* The original state of the IP forwarding proc entry */
+ static char orig_fwd_state;
+ static char orig_global_redirect_state;
+ 
  /**
   *Bind a socket to a device
***************
*** 79,84 ****
  
  
- 
- 
  /**
   *Enable IP forwarding.
--- 83,86 ----
***************
*** 208,212 ****
   */ 
  int
! disable_redirects(char *if_name, int index, int version)
  {
    FILE *proc_redirect;
--- 210,214 ----
   */ 
  int
! disable_redirects(const char *if_name, struct interface *iface, int version)
  {
    FILE *proc_redirect;
***************
*** 229,233 ****
    else
      {
!       nic_states[index].redirect = fgetc(proc_redirect);
        fclose(proc_redirect);
        
--- 231,235 ----
    else
      {
!       iface->nic_state.redirect = fgetc(proc_redirect);
        fclose(proc_redirect);
        
***************
*** 258,262 ****
   */ 
  int
! deactivate_spoof(char *if_name, int index, int version)
  {
    FILE *proc_spoof;
--- 260,264 ----
   */ 
  int
! deactivate_spoof(const char *if_name, struct interface *iface, int version)
  {
    FILE *proc_spoof;
***************
*** 280,284 ****
    else
      {
!       nic_states[index].spoof = fgetc(proc_spoof);
        fclose(proc_spoof);
        
--- 282,286 ----
    else
      {
!       iface->nic_state.spoof = fgetc(proc_spoof);
        fclose(proc_spoof);
        
***************
*** 382,388 ****
        else
  	{
! 	  syslog(LOG_INFO, "Resetting %s to %c\n", procfile, nic_states[ifs->if_nr].redirect);
  
! 	  fputc(nic_states[ifs->if_nr].redirect, proc_fd);
  	  fclose(proc_fd);
  	}
--- 384,390 ----
        else
  	{
! 	  syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.redirect);
  
! 	  fputc(ifs->nic_state.redirect, proc_fd);
  	  fclose(proc_fd);
  	}
***************
*** 400,406 ****
        else
  	{
! 	  syslog(LOG_INFO, "Resetting %s to %c\n", procfile, nic_states[ifs->if_nr].spoof);
  
! 	  fputc(nic_states[ifs->if_nr].spoof, proc_fd);
  	  fclose(proc_fd);
  	}
--- 402,408 ----
        else
  	{
! 	  syslog(LOG_INFO, "Resetting %s to %c\n", procfile, ifs->nic_state.spoof);
  
! 	  fputc(ifs->nic_state.spoof, proc_fd);
  	  fclose(proc_fd);
  	}

Index: net.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/linux/net.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** net.h	28 Aug 2005 19:30:30 -0000	1.7
--- net.h	4 Feb 2007 23:36:35 -0000	1.8
***************
*** 57,62 ****
  #include "../olsr_protocol.h"
  
- #define MAXIFS                  8 /* Maximum number of network interfaces */
- 
  /* Redirect proc entry */
  #define REDIRECT_PROC "/proc/sys/net/ipv4/conf/%s/send_redirects"
--- 57,60 ----
***************
*** 65,86 ****
  #define SPOOF_PROC "/proc/sys/net/ipv4/conf/%s/rp_filter"
  
! /* The original state of the IP forwarding proc entry */
! char orig_fwd_state;
! char orig_global_redirect_state;
! 
! /* Struct uesd to store original redirect/ingress setting */
! struct nic_state
! {
!   int index; /* The OLSR index of the interface */
!   char redirect; /* The original state of icmp redirect */
!   char spoof; /* The original state of the IP spoof filter */
!   struct nic_state *next;
! };
! 
! struct nic_state nic_states[MAXIFS];
! 
! 
! extern int
! olsr_printf(int, char *, ...);
  
  #endif
--- 63,67 ----
  #define SPOOF_PROC "/proc/sys/net/ipv4/conf/%s/rp_filter"
  
! extern int olsr_printf(int, char *, ...);
  
  #endif





More information about the Olsr-cvs mailing list