0
0
mirror of https://github.com/darkk/redsocks.git synced 2025-08-27 04:05:31 +00:00

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

fixes #28, fixes #22, fixes #24
[1] current "stable" release
This commit is contained in:
Leonid Evdokimov 2012-09-12 02:05:39 +04:00
parent 9352d659ba
commit 18e2b5ed1f
5 changed files with 39 additions and 0 deletions

25
libc-compat.h Normal file
View File

@ -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
libevent-compat.h Normal file
View File

@ -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 File

@ -33,6 +33,7 @@
#include "base.h"
#include "redsocks.h"
#include "utils.h"
#include "libevent-compat.h"
#define REDSOCKS_RELAY_HALFBUFF 4096

View File

@ -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 File

@ -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)
{