Permalink
Browse files

Fix compilation on Ubuntu 10.04 LTS and (hopefully) Debian squeeze[1]

fixes #28, fixes #22, fixes #24
[1] current "stable" release
  • Loading branch information...
1 parent 9352d65 commit 18e2b5ed1ffb3e7c5dfec8ff41b3027163f680ed @darkk committed Sep 11, 2012
Showing with 39 additions and 0 deletions.
  1. +25 −0 libc-compat.h
  2. +11 −0 libevent-compat.h
  3. +1 −0 redsocks.c
  4. +1 −0 redudp.c
  5. +1 −0 utils.c
View
@@ -0,0 +1,25 @@
+#ifndef UUID_67C91670_FCCB_4855_BDF7_609F1EECB8B4
+#define UUID_67C91670_FCCB_4855_BDF7_609F1EECB8B4
+
+/* all these definitions, are included into bits/in.h from libc6-dev 2.15-0ubuntu10
+ * from Ubuntu 12.04 and is not included into libc6-dev 2.11.1-0ubuntu7.10 from
+ * Ubuntu 10.04.
+ * linux/in.h is not included directly because of lots of redefinitions,
+ * extracting single value from linux/in.h is not done because it looks like
+ * autotools reinvention */
+#ifndef IP_ORIGDSTADDR
+# warning Using hardcoded value for IP_ORIGDSTADDR as libc headers do not define it.
+# define IP_ORIGDSTADDR 20
+#endif
+
+#ifndef IP_RECVORIGDSTADDR
+# warning Using hardcoded value for IP_RECVORIGDSTADDR as libc headers do not define it.
+# define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
+#endif
+
+#ifndef IP_TRANSPARENT
+# warning Using hardcoded value for IP_TRANSPARENT as libc headers do not define it.
+# define IP_TRANSPARENT 19
+#endif
+
+#endif // 67C91670_FCCB_4855_BDF7_609F1EECB8B4
View
@@ -0,0 +1,11 @@
+#ifndef UUID_FC148CFA_5ECC_488E_8A62_CD39406C9F1E
+#define UUID_FC148CFA_5ECC_488E_8A62_CD39406C9F1E
+
+/* evutil_socket_t is macros in libevent-2.0, not typedef, libevent-1.4 is
+ * still supported because of Ubuntu 10.04 LTS */
+#ifndef evutil_socket_t
+# warning Using hardcoded value for evutil_socket_t as libevent headers do not define it.
+# define evutil_socket_t int
+#endif
+
+#endif // FC148CFA_5ECC_488E_8A62_CD39406C9F1E
View
@@ -33,6 +33,7 @@
#include "base.h"
#include "redsocks.h"
#include "utils.h"
+#include "libevent-compat.h"
#define REDSOCKS_RELAY_HALFBUFF 4096
View
@@ -32,6 +32,7 @@
#include "main.h"
#include "redsocks.h"
#include "redudp.h"
+#include "libc-compat.h"
#define redudp_log_error(client, prio, msg...) \
redsocks_log_write_plain(__FILE__, __LINE__, __func__, 0, &(client)->clientaddr, get_destaddr(client), prio, ## msg)
View
@@ -25,6 +25,7 @@
#include "log.h"
#include "utils.h"
#include "redsocks.h" // for redsocks_close
+#include "libc-compat.h"
int red_recv_udp_pkt(int fd, char *buf, size_t buflen, struct sockaddr_in *inaddr, struct sockaddr_in *toaddr)
{

0 comments on commit 18e2b5e

Please sign in to comment.