[rb_libtorrent/f19] patch to stop UPNP from openning port 0
leigh123linux
leigh123linux at fedoraproject.org
Sun Jun 15 18:26:01 UTC 2014
commit 73a474a505eb08c66a977b6d0ba884b5ac6b02d3
Author: leigh123linux <leigh123linux at googlemail.com>
Date: Sun Jun 15 19:25:46 2014 +0100
patch to stop UPNP from openning port 0
rb_libtorrent-0.16.8-upnp_remove_port0..patch | 50 +++++++++++++++++++++++++
rb_libtorrent.spec | 8 +++-
2 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/rb_libtorrent-0.16.8-upnp_remove_port0..patch b/rb_libtorrent-0.16.8-upnp_remove_port0..patch
new file mode 100644
index 0000000..99dfea3
--- /dev/null
+++ b/rb_libtorrent-0.16.8-upnp_remove_port0..patch
@@ -0,0 +1,50 @@
+--- a/src/upnp.cpp
++++ b/src/upnp.cpp
+@@ -1286,21 +1286,11 @@
+ update_map(d, mapping, l);
+ return;
+ }
+- else if (s.error_code == 718 || s.error_code == 727)
++ else if (s.error_code == 727)
+ {
+- if (m.external_port != 0)
+- {
+- // conflict in mapping, set port to wildcard
+- // and let the router decide
+- m.external_port = 0;
+- m.action = mapping_t::action_add;
+- ++m.failcount;
+- update_map(d, mapping, l);
+- return;
+- }
+ return_error(mapping, s.error_code, l);
+ }
+- else if (s.error_code == 716 || (s.error_code == 501 && m.failcount < 4 && m.external_port == 0))
++ else if (s.error_code == 718 || (s.error_code == 501 && m.failcount < 4))
+ {
+ // some routers return 501 action failed, instead of 716
+ // The external port cannot be wildcarder
+
+--- a/src/session_impl.cpp
++++ b/src/session_impl.cpp
+@@ -2392,7 +2392,8 @@
+ m_tcp_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, tcp_port, tcp_port);
+ #ifdef TORRENT_USE_OPENSSL
+ if (m_ssl_mapping[0] != -1) m_natpmp->delete_mapping(m_ssl_mapping[0]);
+- m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp, ssl_port, ssl_port);
++ if (ssl_port > 0) m_ssl_mapping[0] = m_natpmp->add_mapping(natpmp::tcp
++ , ssl_port, ssl_port);
+ #endif
+ }
+ if ((mask & 2) && m_upnp.get())
+@@ -2401,7 +2402,8 @@
+ m_tcp_mapping[1] = m_upnp->add_mapping(upnp::tcp, tcp_port, tcp_port);
+ #ifdef TORRENT_USE_OPENSSL
+ if (m_ssl_mapping[1] != -1) m_upnp->delete_mapping(m_ssl_mapping[1]);
+- m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp, ssl_port, ssl_port);
++ if (ssl_port > 0) m_ssl_mapping[1] = m_upnp->add_mapping(upnp::tcp
++ , ssl_port, ssl_port);
+ #endif
+ }
+ }
+
diff --git a/rb_libtorrent.spec b/rb_libtorrent.spec
index 62abe81..041e9a3 100644
--- a/rb_libtorrent.spec
+++ b/rb_libtorrent.spec
@@ -1,6 +1,6 @@
Name: rb_libtorrent
Version: 0.16.8
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: A C++ BitTorrent library aiming to be the best alternative
Group: System Environment/Libraries
@@ -12,6 +12,8 @@ Source1: %{name}-README-renames.Fedora
Source2: %{name}-COPYING.Boost
Source3: %{name}-COPYING.zlib
+# https://github.com/qbittorrent/qBittorrent/issues/1758
+Patch0: %{name}-0.16.8-upnp_remove_port0..patch
BuildRequires: asio-devel
BuildRequires: boost-devel
@@ -83,6 +85,7 @@ module) that allow it to be used from within Python applications.
%prep
%setup -q -n "libtorrent-rasterbar-%{version}"
+%patch0 -p1
## The RST files are the sources used to create the final HTML files; and are
## not needed.
@@ -168,6 +171,9 @@ rm -fv %{buildroot}%{_libdir}/lib*.a
%{python_sitearch}/libtorrent.so
%changelog
+* Sun Jun 15 2014 Leigh Scott <leigh123linux at googlemail.com> - 0.16.8-2
+- patch to stop UPNP from openning port 0
+
* Sun Feb 24 2013 Rahul Sundaram <sundaram at fedoraproject.org> - 0.16.8-1
- upstream release 0.16.8
More information about the scm-commits
mailing list