[Olsr-cvs] olsrd-current/src/unix ifnet.c,1.39,1.40

Bernd Petrovitsch (spam-protected)
Thu Nov 16 00:08:01 CET 2006


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

Modified Files:
	ifnet.c 
Log Message:
I removed the hardcoded (and BTW never checked) limit on 16 interfaces:

We do this by adding the "struct netbuf" to the "struct interface" because
- we avoid maintaining a separate array of pointers and malloc(3)ed struct's.
- we avoid therefore lots of malloc(3) and free(3).
- we need such a thing anyway for each interface, so why not put it in there
  (and libnet_ctx is also there).
- we do not longer neeed the interface-index as a separate field.

Does anyone know if the MTU of an interface may chnage (and if yes, when)?
Otherwise we could get rid of another field in that struct (and a few lines
of code).

I compile-tested with `make build_all USE_LIBNET=1` but didn't run it.

Downside: One must initialize this struct (or at least the pointer to the
          actual buffer). Therefore the one line change in src/unix/ifnet.c.
          Therefore I broke very probably the Windows port and I can' figure out
          if and where to add such an equivalent thing.

Other changes:
- The libnet_ctx field in struct interface is also in a
  #ifdef USE_LIBNET ... #endif section.



Index: ifnet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/unix/ifnet.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** ifnet.c	11 Oct 2006 20:58:45 -0000	1.39
--- ifnet.c	15 Nov 2006 23:07:59 -0000	1.40
***************
*** 747,750 ****
--- 747,751 ----
      }
  
+   memset(&ifs.netbuf, 0, sizeof(struct olsr_netbuf));
    ifs.int_flags = ifr.ifr_flags;      
  
***************
*** 917,921 ****
--- 918,924 ----
    memcpy(ifp, &ifs, sizeof(struct interface));
    
+ #ifdef USE_LIBNET
    ifp->libnet_ctx = NULL;  
+ #endif
    ifp->gen_properties = NULL;
    ifp->int_name = olsr_malloc(strlen(ifr.ifr_name) + 1, "Interface update 3");





More information about the Olsr-cvs mailing list