[Olsr-dev] patches to make olsrd work on 64bit FreeBSD

John Hay (spam-protected)
Mon Aug 17 09:15:45 CEST 2009


Hi,

Here are a diff against the latest 0.5.6 from hg. It make olsrd compile
on 64bit versions of FreeBSD (which i have not tried previously).

One thing I'm wondering about, the #if in my patch is getting pretty long.
Is there still some BSD OS that do not need the size_t len? Anybody knows?

So is this ok? Can I push it into 0.5.6? Anybody want to test it on a
non-FreeBSD BSD maybe?

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


--- src/bsd/net.c.orig	2009-08-16 18:26:04.000000000 +0200
+++ src/bsd/net.c	2009-08-17 08:57:36.000000000 +0200
@@ -130,7 +130,7 @@
 set_sysctl_int(const char *name, int new)
 {
   int old;
-#if defined(__MacOSX__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__MacOSX__) || defined(__OpenBSD__) || defined(__NetBSD__)
   size_t len = sizeof(old);
 #else
   unsigned int len = sizeof(old);
@@ -540,7 +540,7 @@
         break;
       }
       ifr6.ifr_addr = *sin6;
-      if (ioctl(s6, SIOCGIFAFLAG_IN6, (int)&ifr6) < 0) {
+      if (ioctl(s6, SIOCGIFAFLAG_IN6, &ifr6) < 0) {
         OLSR_PRINTF(3, "ioctl(SIOCGIFAFLAG_IN6)");
         close(s6);
         break;

--- src/bsd/kernel_routes.c.orig	2009-02-01 19:57:23.000000000 +0000
+++ src/bsd/kernel_routes.c	2009-06-17 15:57:01.000000000 +0000
@@ -95,8 +95,8 @@
   sin4.sin_len = sizeof(sin4);
   sin4.sin_family = AF_INET;
 
-  sin_size = 1 + ((sizeof(struct sockaddr_in) - 1) | 3);
-  sdl_size = 1 + ((sizeof(struct sockaddr_dl) - 1) | 3);
+  sin_size = 1 + ((sizeof(struct sockaddr_in) - 1) | (sizeof(long) - 1));
+  sdl_size = 1 + ((sizeof(struct sockaddr_dl) - 1) | (sizeof(long) - 1));
 
   /**********************************************************************
    *                  FILL THE ROUTING MESSAGE HEADER
@@ -250,8 +252,8 @@
   sdl.sdl_len = sizeof(sdl);
   sdl.sdl_family = AF_LINK;
 
-  sin_size = 1 + ((sizeof(struct sockaddr_in6) - 1) | 3);
-  sdl_size = 1 + ((sizeof(struct sockaddr_dl) - 1) | 3);
+  sin_size = 1 + ((sizeof(struct sockaddr_in6) - 1) | (sizeof(long) - 1));
+  sdl_size = 1 + ((sizeof(struct sockaddr_dl) - 1) | (sizeof(long) - 1));
 
   /**********************************************************************
    *                  FILL THE ROUTING MESSAGE HEADER




More information about the Olsr-dev mailing list