Skip to content

Commit

Permalink
Fix compilation on Ubuntu 10.04 LTS and (hopefully) Debian squeeze[1]
Browse files Browse the repository at this point in the history
fixes #28, fixes #22, fixes #24
[1] current "stable" release
  • Loading branch information
darkk committed Sep 11, 2012
1 parent 9352d65 commit 18e2b5e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions libc-compat.h
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions libevent-compat.h
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions redsocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "base.h"
#include "redsocks.h"
#include "utils.h"
#include "libevent-compat.h"


#define REDSOCKS_RELAY_HALFBUFF 4096
Expand Down
1 change: 1 addition & 0 deletions redudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 18e2b5e

Please sign in to comment.