[olsr-dev] Compiling on NetBSD
Stephan Maka
(spam-protected)
Sat Dec 11 16:04:03 CET 2004
Dear OLSR Developers,
I found it very nice to finally have OLSR on FreeBSD. Due to very small
differences between FreeBSD and NetBSD, I did a patch for compiling the
olsrd for NetBSD. It's very nice to have OLSR on my ancient NetBSD
laptop and NetBSD support would open OLSR to a much wider range of
architectures. ;-)
Because I have not such a lot of Wifi-enabled machines, testing by me
hasn't been too excessive.
By the way, I would love to see IPv6 support for BSD hosts. We have our
"standard" (WLAN4Workgroups) for a v6 address scheme to quickly
establish a MANET whenever we meet.
Thank you for developing Unik OLSR,
Stephan Maka.
-------------- next part --------------
diff -urN olsrd-current/Makefile olsrd-current-netbsd/Makefile
--- olsrd-current/Makefile Sat Dec 11 13:51:23 2004
+++ olsrd-current-netbsd/Makefile Sat Dec 11 15:30:47 2004
@@ -90,6 +90,15 @@
MAKEDEPEND = makedepend -f $(DEPFILE) -D__FreeBSD__ $(INCLUDES) $(SRCS)
else
+ifeq ($(OS), nbsd)
+
+SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
+HDRS += $(wildcard src/bsd/*.h) $(wildcard src/unix/*.h)
+CFLAGS ?= -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -g
+LIBS = -lm
+MAKEDEPEND = makedepend -f $(DEPFILE) -D__NetBSD__ $(INCLUDES) $(SRCS)
+
+else
ifeq ($(OS), osx)
SRCS += $(wildcard src/bsd/*.c) $(wildcard src/unix/*.c)
@@ -167,6 +176,7 @@
endif
endif
endif
+endif
OBJS = $(patsubst %.c,%.o,$(SRCS))
override CFLAGS += $(INCLUDES) $(DEFINES)
@@ -200,6 +210,7 @@
@echo ' linux - GNU/Linux '
@echo ' win32 - MS Windows '
@echo ' fbsd - FreeBSD '
+ @echo ' nbsd - NetBSD '
@echo ' osx - Mac OS X '
@echo ' --------------------------------- '
@echo ' Example - build for windows: '
diff -urN olsrd-current/src/bsd/net.c olsrd-current-netbsd/src/bsd/net.c
--- olsrd-current/src/bsd/net.c Sat Dec 11 13:51:40 2004
+++ olsrd-current-netbsd/src/bsd/net.c Sat Dec 11 15:31:07 2004
@@ -43,6 +43,10 @@
#include "../net_os.h"
#include "net.h"
+#ifdef __NetBSD__
+#include <sys/param.h>
+#endif
+
#include <sys/sysctl.h>
static int ignore_redir;
diff -urN olsrd-current/src/cfgparser/Makefile olsrd-current-netbsd/src/cfgparser/Makefile
--- olsrd-current/src/cfgparser/Makefile Sat Dec 11 13:51:40 2004
+++ olsrd-current-netbsd/src/cfgparser/Makefile Sat Dec 11 15:31:26 2004
@@ -63,6 +63,10 @@
DEPFLAGS += -D__FreeBSD__
endif
+ifeq ($(OS), nbsd)
+DEPFLAGS += -D__NetBSD__
+endif
+
ifeq ($(OS), osx)
DEPFLAGS += -D__MacOSX__
endif
diff -urN olsrd-current/src/defs.h olsrd-current-netbsd/src/defs.h
--- olsrd-current/src/defs.h Sat Dec 11 13:51:33 2004
+++ olsrd-current-netbsd/src/defs.h Sat Dec 11 15:31:10 2004
@@ -144,7 +144,7 @@
/* routing socket */
-#if defined __FreeBSD__ || defined __MacOSX__
+#if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__
int rts;
#endif
diff -urN olsrd-current/src/main.c olsrd-current-netbsd/src/main.c
--- olsrd-current/src/main.c Sat Dec 11 13:51:34 2004
+++ olsrd-current-netbsd/src/main.c Sat Dec 11 15:31:17 2004
@@ -480,7 +480,7 @@
olsr_exit(__func__, 0);
}
-#if defined __FreeBSD__ || defined __MacOSX__
+#if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__
if ((rts = socket(PF_ROUTE, SOCK_RAW, 0)) < 0)
{
olsr_syslog(OLSR_LOG_ERR, "routing socket: %m");
@@ -690,7 +690,7 @@
/* ioctl socket */
close(ioctl_s);
-#if defined __FreeBSD__ || defined __MacOSX__
+#if defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__
/* routing socket */
close(rts);
#endif
diff -urN olsrd-current/src/net.c olsrd-current-netbsd/src/net.c
--- olsrd-current/src/net.c Sat Dec 11 13:51:34 2004
+++ olsrd-current-netbsd/src/net.c Sat Dec 11 15:31:19 2004
@@ -477,7 +477,7 @@
COPY_IP(&mcastreq.ipv6mr_multiaddr, &ifs->int6_multaddr.sin6_addr);
mcastreq.ipv6mr_interface = ifs->if_index;
-#if !defined __FreeBSD__ && !defined __MacOSX__
+#if !defined __FreeBSD__ && !defined __MacOSX__ && !defined __NetBSD__
olsr_printf(3, "Interface %s joining multicast %s...", ifs->int_name, olsr_ip_to_string((union olsr_ip_addr *)&ifs->int6_multaddr.sin6_addr));
/* Send multicast */
if(setsockopt(sock,
diff -urN olsrd-current/src/olsr_protocol.h olsrd-current-netbsd/src/olsr_protocol.h
--- olsrd-current/src/olsr_protocol.h Sat Dec 11 13:51:35 2004
+++ olsrd-current-netbsd/src/olsr_protocol.h Sat Dec 11 15:31:21 2004
@@ -75,7 +75,7 @@
typedef int16_t olsr_16_t;
typedef int32_t olsr_32_t;
-#elif defined __FreeBSD__
+#elif defined __FreeBSD__ || defined __NetBSD__
typedef uint8_t olsr_u8_t;
typedef uint16_t olsr_u16_t;
diff -urN olsrd-current/src/unix/ifnet.c olsrd-current-netbsd/src/unix/ifnet.c
--- olsrd-current/src/unix/ifnet.c Sat Dec 11 13:51:42 2004
+++ olsrd-current-netbsd/src/unix/ifnet.c Sat Dec 11 15:31:35 2004
@@ -54,7 +54,7 @@
#define SIOCGIWMODE 0x8B07 /* get operation mode */
#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
-#elif defined __FreeBSD__ || defined __MacOSX__
+#elif defined __FreeBSD__ || defined __MacOSX__ || defined __NetBSD__
#define ifr_netmask ifr_addr
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20041211/ec3e1fbe/attachment.sig>
More information about the Olsr-dev
mailing list