Package: bittorrent
Version: 3.4.2-11.5
Severity: normal
Tags: ipv6 patch upstream

Hello,

Bittorrent currently doesn't listen on IPv6.  The attached patch fixes
it by trying to listen on IPv6 if available in the system.

Samuel

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12.0 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bittorrent depends on:
ii  lsb-base        4.1+Debian12
ii  python          2.7.5-5
ii  python-support  1.0.15

Versions of packages bittorrent recommends:
ii  mime-support  3.54

Versions of packages bittorrent suggests:
pn  bittorrent-gui  <none>

-- no debconf information

-- 
Samuel
<v> je viens d'inventer mutt version magritte :D
<y> ?
<v> dans mutt
<v> tape "cceci" return
--- ./BitTorrent/RawServer.py.original  2013-11-24 20:58:29.784912884 +0100
+++ ./BitTorrent/RawServer.py   2013-11-24 21:07:30.889134867 +0100
@@ -111,7 +111,14 @@
 
     def bind(self, port, bind = '', reuse = False):
         self.bindaddr = bind
-        server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        try:
+            server = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+            try:
+                server.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+            except:
+                pass
+        except:
+            server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         if reuse:
             server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
         server.setblocking(0)
@@ -127,7 +134,14 @@
     def start_connection(self, dns, handler = None):
         if handler is None:
             handler = self.handler
-        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        try:
+            sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+            try:
+                sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0)
+            except:
+                pass
+        except:
+            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         sock.setblocking(0)
         try:
             sock.setsockopt(socket.IPPROTO_IP, socket.IP_TOS, 32)

Reply via email to