1 |
blueness 12/03/23 01:00:32 |
2 |
|
3 |
Added: tor-0.2.3.12_alpha-fix-miniupnpc-1.6.patch |
4 |
Log: |
5 |
Add patch to fix bug #376621 |
6 |
|
7 |
(Portage version: 2.1.10.49/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 net-misc/tor/files/tor-0.2.3.12_alpha-fix-miniupnpc-1.6.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor-0.2.3.12_alpha-fix-miniupnpc-1.6.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/tor/files/tor-0.2.3.12_alpha-fix-miniupnpc-1.6.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: tor-0.2.3.12_alpha-fix-miniupnpc-1.6.patch |
16 |
=================================================================== |
17 |
From cc6282b77e6f1284d1381e02511720ae2adc7c96 Mon Sep 17 00:00:00 2001 |
18 |
From: Anthony G. Basile <blueness@g.o> |
19 |
Date: Thu, 22 Mar 2012 12:09:40 -0400 |
20 |
Subject: [PATCH] Fix compile error against miniupnpc-1.6 when --enable-upnp |
21 |
|
22 |
The bump from miniupnpc-1.5 to 1.6 changes the definition of |
23 |
two functions used by tor-fw-helper-upnp.c, upnpDiscover() and |
24 |
UPNP_AddPortMapping(). This patch addresses this and adds a |
25 |
check in configure.in for backwards compatibility. |
26 |
|
27 |
Thanks to Nickolay Kolchin-Semyonov for some hints. |
28 |
|
29 |
X-Tor-Bug-URL: https://trac.torproject.org/projects/tor/ticket/5434 |
30 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=376621 |
31 |
Signed-off-by: Anthony G. Basile <blueness@g.o> |
32 |
--- |
33 |
configure.in | 37 +++++++++++++++++++------ |
34 |
src/tools/tor-fw-helper/tor-fw-helper-upnp.c | 8 +++++ |
35 |
2 files changed, 36 insertions(+), 9 deletions(-) |
36 |
|
37 |
diff --git a/configure.in b/configure.in |
38 |
index 7415ce8..946f780 100644 |
39 |
--- a/configure.in |
40 |
+++ b/configure.in |
41 |
@@ -592,15 +592,34 @@ dnl There are no packages for Debian or Redhat as of this patch |
42 |
|
43 |
if test "$upnp" = "true"; then |
44 |
AC_DEFINE(MINIUPNPC, 1, [Define to 1 if we are building with UPnP.]) |
45 |
- TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI], |
46 |
- [#include <miniupnpc/miniwget.h> |
47 |
- #include <miniupnpc/miniupnpc.h> |
48 |
- #include <miniupnpc/upnpcommands.h>], |
49 |
- [void upnpDiscover(int delay, const char * multicastif, |
50 |
- const char * minissdpdsock, int sameport);], |
51 |
- [upnpDiscover(1, 0, 0, 0); exit(0);], |
52 |
- [--with-libminiupnpc-dir], |
53 |
- [/usr/lib/]) |
54 |
+ |
55 |
+ dnl Before we call TOR_SEARCH_LIBRARY we'll do a quick compile test |
56 |
+ dnl to see if we have miniupnpc-1.5 or -1.6 |
57 |
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>], |
58 |
+ [upnpDiscover(1, 0, 0, 0);exit(0);])],[miniupnpc15="true"],[miniupnpc15="false"]) |
59 |
+ |
60 |
+ if test "$miniupnpc15" = "true" ; then |
61 |
+ AC_DEFINE([MINIUPNPC15],[1],[libminiupnpc version 1.5 found]) |
62 |
+ TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI], |
63 |
+ [#include <miniupnpc/miniwget.h> |
64 |
+ #include <miniupnpc/miniupnpc.h> |
65 |
+ #include <miniupnpc/upnpcommands.h>], |
66 |
+ [void upnpDiscover(int delay, const char * multicastif, |
67 |
+ const char * minissdpdsock, int sameport);], |
68 |
+ [upnpDiscover(1, 0, 0, 0); exit(0);], |
69 |
+ [--with-libminiupnpc-dir], |
70 |
+ [/usr/lib/]) |
71 |
+ else |
72 |
+ TOR_SEARCH_LIBRARY(libminiupnpc, $trylibminiupnpcdir, [-lminiupnpc $TOR_LIB_WS32 $TOR_LIB_IPHLPAPI], |
73 |
+ [#include <miniupnpc/miniwget.h> |
74 |
+ #include <miniupnpc/miniupnpc.h> |
75 |
+ #include <miniupnpc/upnpcommands.h>], |
76 |
+ [void upnpDiscover(int delay, const char * multicastif, |
77 |
+ const char * minissdpdsock, int sameport, int ipv6, int * error);], |
78 |
+ [upnpDiscover(1, 0, 0, 0, 0, 0); exit(0);], |
79 |
+ [--with-libminiupnpc-dir], |
80 |
+ [/usr/lib/]) |
81 |
+ fi |
82 |
fi |
83 |
|
84 |
AC_SYS_LARGEFILE |
85 |
diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c |
86 |
index 442eae5..ee56f71 100644 |
87 |
--- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c |
88 |
+++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c |
89 |
@@ -78,7 +78,11 @@ tor_upnp_init(tor_fw_options_t *options, void *backend_state) |
90 |
memset(&(state->data), 0, sizeof(struct IGDdatas)); |
91 |
state->init = 0; |
92 |
|
93 |
+#ifdef MINIUPNPC15 |
94 |
devlist = upnpDiscover(UPNP_DISCOVER_TIMEOUT, NULL, NULL, 0); |
95 |
+#else |
96 |
+ devlist = upnpDiscover(UPNP_DISCOVER_TIMEOUT, NULL, NULL, 0, 0, NULL); |
97 |
+#endif |
98 |
if (NULL == devlist) { |
99 |
fprintf(stderr, "E: upnpDiscover returned: NULL\n"); |
100 |
return UPNP_ERR_NODEVICESFOUND; |
101 |
@@ -178,7 +182,11 @@ tor_upnp_add_tcp_mapping(tor_fw_options_t *options, void *backend_state) |
102 |
r = UPNP_AddPortMapping(state->urls.controlURL, |
103 |
state->data.first.servicetype, |
104 |
external_port_str, internal_port_str, |
105 |
+#ifdef MINIUPNPC15 |
106 |
state->lanaddr, UPNP_DESC, "TCP", 0); |
107 |
+#else |
108 |
+ state->lanaddr, UPNP_DESC, "TCP", 0, 0); |
109 |
+#endif |
110 |
if (r != UPNPCOMMAND_SUCCESS) |
111 |
return UPNP_ERR_ADDPORTMAPPING; |
112 |
|
113 |
-- |
114 |
1.7.3.4 |