Commit d13175e1 authored by dermiste's avatar dermiste

portability fixes

parent c0008e70
...@@ -111,7 +111,7 @@ main(int argc, char **argv) ...@@ -111,7 +111,7 @@ main(int argc, char **argv)
gettime(&now); gettime(&now);
rfd = open("/dev/urandom", O_RDONLY); rfd = open(RND_DEV, O_RDONLY);
if(rfd < 0) { if(rfd < 0) {
perror("open(random)"); perror("open(random)");
} else { } else {
......
...@@ -80,6 +80,14 @@ THE SOFTWARE. ...@@ -80,6 +80,14 @@ THE SOFTWARE.
#endif #endif
#endif #endif
#if defined(__linux)
#define RND_DEV "/dev/urandom"
#elif defined(__OpenBSD__)
#define RND_DEV "/dev/arandom"
#else
#error "don't know which random device to use"
#endif
extern struct timeval now; extern struct timeval now;
extern int debug; extern int debug;
extern time_t reboot_time; extern time_t reboot_time;
......
...@@ -24,7 +24,7 @@ THE SOFTWARE. ...@@ -24,7 +24,7 @@ THE SOFTWARE.
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifndef __APPLE__ #ifdef __linux
/* Defining it rather than including <linux/rtnetlink.h> because this /* Defining it rather than including <linux/rtnetlink.h> because this
* implies <asm/types.h> on Linux 2.4 */ * implies <asm/types.h> on Linux 2.4 */
#define RTPROT_BOOT 3 /* Route installed during boot */ #define RTPROT_BOOT 3 /* Route installed during boot */
...@@ -646,7 +646,7 @@ filter_match(struct filter *f, const unsigned char *id, ...@@ -646,7 +646,7 @@ filter_match(struct filter *f, const unsigned char *id,
return 0; return 0;
} else if(proto == RTPROT_BABEL_LOCAL) { } else if(proto == RTPROT_BABEL_LOCAL) {
return 0; return 0;
#ifndef __APPLE__ #ifdef __linux
} else if(proto == RTPROT_BOOT) { } else if(proto == RTPROT_BOOT) {
return 0; return 0;
#endif #endif
......
...@@ -26,10 +26,10 @@ THE SOFTWARE. ...@@ -26,10 +26,10 @@ THE SOFTWARE.
#include "babeld.h" #include "babeld.h"
#ifdef __APPLE__ #ifdef __linux
#include "kernel_socket.c"
#else
#include "kernel_netlink.c" #include "kernel_netlink.c"
#else
#include "kernel_socket.c"
#endif #endif
/* Like gettimeofday, but returns monotonic time. If POSIX clocks are not /* Like gettimeofday, but returns monotonic time. If POSIX clocks are not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment