You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.2 KiB

  1. From 18e2b5ed1ffb3e7c5dfec8ff41b3027163f680ed Mon Sep 17 00:00:00 2001
  2. From: Leonid Evdokimov <leon@darkk.net.ru>
  3. Date: Wed, 12 Sep 2012 02:05:39 +0400
  4. Subject: [PATCH 09/12] Fix compilation on Ubuntu 10.04 LTS and (hopefully)
  5. Debian squeeze[1]
  6. fixes #28, fixes #22, fixes #24
  7. [1] current "stable" release
  8. ---
  9. libc-compat.h | 25 +++++++++++++++++++++++++
  10. libevent-compat.h | 11 +++++++++++
  11. redsocks.c | 1 +
  12. redudp.c | 1 +
  13. utils.c | 1 +
  14. 5 files changed, 39 insertions(+)
  15. create mode 100644 libc-compat.h
  16. create mode 100644 libevent-compat.h
  17. diff --git a/libc-compat.h b/libc-compat.h
  18. new file mode 100644
  19. index 0000000..adcf63b
  20. --- /dev/null
  21. +++ b/libc-compat.h
  22. @@ -0,0 +1,25 @@
  23. +#ifndef UUID_67C91670_FCCB_4855_BDF7_609F1EECB8B4
  24. +#define UUID_67C91670_FCCB_4855_BDF7_609F1EECB8B4
  25. +
  26. +/* all these definitions, are included into bits/in.h from libc6-dev 2.15-0ubuntu10
  27. + * from Ubuntu 12.04 and is not included into libc6-dev 2.11.1-0ubuntu7.10 from
  28. + * Ubuntu 10.04.
  29. + * linux/in.h is not included directly because of lots of redefinitions,
  30. + * extracting single value from linux/in.h is not done because it looks like
  31. + * autotools reinvention */
  32. +#ifndef IP_ORIGDSTADDR
  33. +# warning Using hardcoded value for IP_ORIGDSTADDR as libc headers do not define it.
  34. +# define IP_ORIGDSTADDR 20
  35. +#endif
  36. +
  37. +#ifndef IP_RECVORIGDSTADDR
  38. +# warning Using hardcoded value for IP_RECVORIGDSTADDR as libc headers do not define it.
  39. +# define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
  40. +#endif
  41. +
  42. +#ifndef IP_TRANSPARENT
  43. +# warning Using hardcoded value for IP_TRANSPARENT as libc headers do not define it.
  44. +# define IP_TRANSPARENT 19
  45. +#endif
  46. +
  47. +#endif // 67C91670_FCCB_4855_BDF7_609F1EECB8B4
  48. diff --git a/libevent-compat.h b/libevent-compat.h
  49. new file mode 100644
  50. index 0000000..a7f1ca1
  51. --- /dev/null
  52. +++ b/libevent-compat.h
  53. @@ -0,0 +1,11 @@
  54. +#ifndef UUID_FC148CFA_5ECC_488E_8A62_CD39406C9F1E
  55. +#define UUID_FC148CFA_5ECC_488E_8A62_CD39406C9F1E
  56. +
  57. +/* evutil_socket_t is macros in libevent-2.0, not typedef, libevent-1.4 is
  58. + * still supported because of Ubuntu 10.04 LTS */
  59. +#ifndef evutil_socket_t
  60. +# warning Using hardcoded value for evutil_socket_t as libevent headers do not define it.
  61. +# define evutil_socket_t int
  62. +#endif
  63. +
  64. +#endif // FC148CFA_5ECC_488E_8A62_CD39406C9F1E
  65. diff --git a/redsocks.c b/redsocks.c
  66. index ba5eab2..878576f 100644
  67. --- a/redsocks.c
  68. +++ b/redsocks.c
  69. @@ -33,6 +33,7 @@
  70. #include "base.h"
  71. #include "redsocks.h"
  72. #include "utils.h"
  73. +#include "libevent-compat.h"
  74. #define REDSOCKS_RELAY_HALFBUFF 4096
  75. diff --git a/redudp.c b/redudp.c
  76. index 262af3e..05460dc 100644
  77. --- a/redudp.c
  78. +++ b/redudp.c
  79. @@ -32,6 +32,7 @@
  80. #include "main.h"
  81. #include "redsocks.h"
  82. #include "redudp.h"
  83. +#include "libc-compat.h"
  84. #define redudp_log_error(client, prio, msg...) \
  85. redsocks_log_write_plain(__FILE__, __LINE__, __func__, 0, &(client)->clientaddr, get_destaddr(client), prio, ## msg)
  86. diff --git a/utils.c b/utils.c
  87. index 31c6894..7de3969 100644
  88. --- a/utils.c
  89. +++ b/utils.c
  90. @@ -25,6 +25,7 @@
  91. #include "log.h"
  92. #include "utils.h"
  93. #include "redsocks.h" // for redsocks_close
  94. +#include "libc-compat.h"
  95. int red_recv_udp_pkt(int fd, char *buf, size_t buflen, struct sockaddr_in *inaddr, struct sockaddr_in *toaddr)
  96. {
  97. --
  98. 1.9.1