[Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.23,1.24

Bernd Petrovitsch (spam-protected)
Thu Nov 8 23:47:42 CET 2007


Update of /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28726/lib/dyn_gw/src

Modified Files:
	olsrd_dyn_gw.c 
Log Message:
Another fat commit:

The main target was:
- Fixed the misleading definition of "v4" in "struct olsr_ip_addr" fom
  "olsr_u32_t" (in network-byteorder!) to "struct in_addr". Lots of
  temporary variables to call inet_ntoa()/inet_ptoa() vanished .....
- declare "int_addr", "int_netmask" and "int_broadaddr" in "struct interface"
  as "struct sockaddr_in" since it is that what we actually want there (and
  it is similar to the IPv6 code).

To get that thoroughly via compiler errors, we get:
- We have now ip4_to_string(), ip6_to_string() and olsr_ip_to_string()
  to print a "struct in_addr", "struct in6_addr" and "union olsr_ip_addr"
  into a string buffer.

Alas, this also annoyed me since ages:
- cleanup: olsr_ip_to_string() and similar non-reentrant functions now must
  get a target buffer. To ease that, there is the "struct ipaddr_str"
  which is large enough for all of them (read: for an IPv6 address). This
  also removes the cyclic buffer there.
  All of these function return a "const char *" which can be directly used
  for printf(3) and friends.

And some cleanups:
- const'ified more functions
- converted the source to UTF-8.
- "struct sig_msg" uses an olsr_u8_t for a byte array (and not "char")
- force the few inline function to always be inlined.
- #ifdef the body of the olsr_print_hna_set() and olsr_print_neighbor_table()
  if nothing is done
- use "inline_avl_comp_ipv4()" in "avl_comp_ipv4()"
- clean up the routes on more signals. Basically we want to do this on all
  signals which terminate the program.
- killed a superflous global buffer in src/main.c

This version was breing since weeks and running for severa day in Vienna's
FunkFeuer net without any noticably problem!

Please report anything that broke!



Index: olsrd_dyn_gw.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/dyn_gw/src/olsrd_dyn_gw.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** olsrd_dyn_gw.c	17 Sep 2007 21:57:05 -0000	1.23
--- olsrd_dyn_gw.c	8 Nov 2007 22:47:39 -0000	1.24
***************
*** 166,171 ****
          union olsr_ip_addr temp_net;
          union olsr_ip_addr temp_netmask;
!         temp_net.v4 = INET_NET;
!         temp_netmask.v4 = INET_PREFIX;
          the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask);
          if (the_hna_list == NULL) {
--- 166,171 ----
          union olsr_ip_addr temp_net;
          union olsr_ip_addr temp_netmask;
!         temp_net.v4.s_addr = INET_NET;
!         temp_netmask.v4.s_addr = INET_PREFIX;
          the_hna_list = add_to_hna_list(the_hna_list, &temp_net, &temp_netmask);
          if (the_hna_list == NULL) {
***************
*** 365,372 ****
          if( (iflags & RTF_UP) &&
              (metric == 0) &&
!             (netmask == mask->v4) && 
!             (dest_addr == net->v4))
            {
!             if ( ((mask->v4==INET_PREFIX)&&(net->v4==INET_NET))&&(!(iflags & RTF_GATEWAY)))
                {
                  fclose(fp);  
--- 365,372 ----
          if( (iflags & RTF_UP) &&
              (metric == 0) &&
!             (netmask == mask->v4.s_addr) && 
!             (dest_addr == net->v4.s_addr))
            {
!             if ( ((mask->v4.s_addr == INET_PREFIX)&&(net->v4.s_addr == INET_NET))&&(!(iflags & RTF_GATEWAY)))
                {
                  fclose(fp);  
***************
*** 389,393 ****
      fclose(fp);      
      if(retval == 0){
!       olsr_printf(1, "HNA[%08x/%08x] is invalid\n", net->v4,mask->v4);
      }  
      return retval;
--- 389,393 ----
      fclose(fp);      
      if(retval == 0){
!       olsr_printf(1, "HNA[%08x/%08x] is invalid\n", net->v4.s_addr, mask->v4.s_addr);
      }  
      return retval;





More information about the Olsr-cvs mailing list