[OLSR-users] olsr_prefix_to_netmask() and olsr_netmask_to_prefix() broken?

John Hay (spam-protected)
Sat Sep 30 09:24:06 CEST 2006


Hi,

While porting olsrd to FreeBSD IPv6, I found that hna6 routes with a
prefix that is not a byte multiple is broken. The hna6 route that I
wanted to add is "2000:: 3"

Here is a patch to make it work.

The rest of my port is with David Cornejo for review and hopefully
commit when he is happy with it.

With these patches we have a basic ipv6 olsr mesh going on FreeBSD,
even with a few machines with multiple interfaces on the same
subnet.

John
-- 
John Hay -- (spam-protected) / (spam-protected)


--- src/net_olsr.c.orig	Thu Dec 29 20:37:16 2005
+++ src/net_olsr.c	Fri Sep 29 21:59:39 2006
@@ -526,7 +526,7 @@
 
   for(;p > 0; p -= 8)
     {
-      adr->v6.s6_addr[i] = (p < 8) ? 0xff ^ (0xff << p) : 0xff;
+      adr->v6.s6_addr[i] = (p < 8) ? 0xff ^ (0xff >> p) : 0xff;
       i++;
     }
 
@@ -564,7 +564,7 @@
 	{
 	  for(tmp = adr->v6.s6_addr[i];
 	      tmp > 0;
-	      tmp = tmp >> 1)
+	      tmp = (tmp << 1) & 0xff)
 	    prefix++;
 	}
     }




More information about the Olsr-users mailing list