Opened 7 years ago

Last modified 7 years ago

#5545 new Bug

Dual stack connection switches too fast.

Reported by: jackyyf Owned by:
Priority: Normal Milestone: None Set
Component: Transmission Version: 2.82
Severity: Normal Keywords: DualStack IPv6 Connection
Cc:

Description

I have a 100Mbps network for both ipv4 and ipv6, recently I have found if another peer also have both ipv4 and ipv6 connection available, a very frequent (around 1 time per second) protocol switch (between ipv4 and ipv6) is performed, and each switch cause old connection closed, which makes it impossible to upload so short active connection.

Transmission peers page shows both ipv4 and ipv6 connection are outbound connection.

Change History (1)

comment:1 Changed 7 years ago by reardon

I have seen this for a long time; its bad enough that I decided to just disable output IP6 connections. I allow inbound but not outbound.

This is important for two reasons: (1) is the one you describe, and (2) is that transmission doesn't currently detect Teredo et al tunnels. See the following, a hacky patch:

Index: libtransmission/net.c
===================================================================
--- libtransmission/net.c       (revision 13680)
+++ libtransmission/net.c       (working copy)
@@ -644,6 +644,18 @@
     }
 }

+static bool
+isIPv6tunnelled (const tr_address * addr)
+{
+    if (addr->type == TR_AF_INET6)
+    {
+        const uint8_t *a = addr->addr.addr6.__in6_u.__u6_addr8;
+        if ( (a[0]==0x20 && a[1]==0x01 && a[2]==0x00 && a[3]==0x00) || (a[0]==0x20 && a[1]==0x02) )
+            return true;
+    }
+    return false;
+}
+
 bool
 tr_address_is_valid_for_peers (const tr_address * addr, tr_port port)
 {
@@ -651,5 +663,6 @@
         && (tr_address_is_valid (addr))
         && (!isIPv6LinkLocalAddress (addr))
         && (!isIPv4MappedAddress (addr))
+        && (!isIPv6tunnelled (addr))
         && (!isMartianAddr (addr));
 }
Index: libtransmission/peer-msgs.c
===================================================================
--- libtransmission/peer-msgs.c (revision 13680)
+++ libtransmission/peer-msgs.c (working copy)
@@ -820,7 +820,7 @@
     tr_variantInitDict (&val, 8);
     tr_variantDictAddInt (&val, "e", getSession (msgs)->encryptionMode != TR_CLEAR_PREFERRED);
     if (ipv6 != NULL)
-        tr_variantDictAddRaw (&val, "ipv6", ipv6, 16);
+        {} //tr_bencDictAddRaw (&val, "ipv6", ipv6, 16);
     if (allow_metadata_xfer && tr_torrentHasMetadata (msgs->torrent)
                             && (msgs->torrent->infoDictLength > 0))
         tr_variantDictAddInt (&val, "metadata_size", msgs->torrent->infoDictLength);

Note: See TracTickets for help on using tickets.