[Olsr-cvs] olsrd-current/src parser.c, 1.36, 1.37 olsr.c, 1.63, 1.64 lq_packet.c, 1.31, 1.32

Bernd Petrovitsch (spam-protected)
Thu Nov 29 01:24:02 CET 2007


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

Modified Files:
	parser.c olsr.c lq_packet.c 
Log Message:
Patch from Sven-Ola Tücke <(spam-protected)> from
http://download-master.berlin.freifunk.net/sven-ola/nylon/packages/olsrd/files/132-save-the-fish.patch:
really savet he fish and avoid to forward invlaid messages from older olsrd versions


Index: parser.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/parser.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** parser.c	8 Nov 2007 22:47:41 -0000	1.36
--- parser.c	29 Nov 2007 00:24:00 -0000	1.37
***************
*** 257,260 ****
--- 257,270 ----
  
  
+ #if 0
+       /*
+        * Sven-Ola: This code leads to flooding our meshes with invalid /
+        * overdue messages if lq_fish is enabled (which is true since 2005)
+        * because there was no "do not forward"-check in olsr.c. If a message
+        * (yes: ttl=0 is invalid) is received, we should say: Welcome message,
+        * let us evaluate! But: if TTL < 2 or TTL + hopcount is higher than
+        * plausible, we should not forward. See olsr.c:olsr_forward_message()
+        */
+        
        /* Treat TTL hopcnt */
        if(olsr_cnf->ip_version == AF_INET)
***************
*** 286,289 ****
--- 296,300 ----
  	    }
  	}
+ #endif
  
        /*RFC 3626 section 3.4:

Index: lq_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** lq_packet.c	16 Nov 2007 22:56:54 -0000	1.31
--- lq_packet.c	29 Nov 2007 00:24:00 -0000	1.32
***************
*** 150,154 ****
  {
    int i;
!   static int ttl_list[] = { 1, 2, 1, 4, 1, 2, 1, 8, 1, 2, 1, 4, 1, 2, 1, MAX_TTL-1, 0};
  
    // remember that we have generated an LQ TC message; this is
--- 150,154 ----
  {
    int i;
!   static int ttl_list[] = { 2, 8, 2, 16, 2, 8, 2, MAX_TTL};
  
    // remember that we have generated an LQ TC message; this is
***************
*** 172,178 ****
        outif->ttl_index = 0;
      
-     if (ttl_list[outif->ttl_index] == 0)
-       outif->ttl_index = 0;
-   
      lq_tc->comm.ttl = ttl_list[outif->ttl_index++];
  
--- 172,175 ----

Index: olsr.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/olsr.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** olsr.c	16 Nov 2007 19:12:55 -0000	1.63
--- olsr.c	29 Nov 2007 00:24:00 -0000	1.64
***************
*** 298,306 ****
    int msgsize;
    struct interface *ifn;
-   const int ttl = olsr_cnf->ip_version == AF_INET ? m->v4.ttl : m->v6.ttl;
  
!   if (ttl < 2) {
!     return 0;
    }
    if(!olsr_check_dup_table_fwd(originator, seqno, &in_if->ip_addr))
      {
--- 298,316 ----
    int msgsize;
    struct interface *ifn;
  
!   /*
!    * Sven-Ola: We should not flood the mesh with overdue messages. Because
!    * of a bug in parser.c:parse_packet, we have a lot of messages because
!    * all older olsrd's have lq_fish enabled.
!    */
!   if (AF_INET == olsr_cnf->ip_version)
!   {
!     if (2 > m->v4.ttl || 255 < (int)m->v4.hopcnt + (int)m->v4.ttl) return 0;
!   }
!   else
!   {
!     if (2 > m->v6.ttl || 255 < (int)m->v6.hopcnt + (int)m->v6.ttl) return 0;
    }
+ 
    if(!olsr_check_dup_table_fwd(originator, seqno, &in_if->ip_addr))
      {





More information about the Olsr-cvs mailing list