transmission / transmission

Official Transmission BitTorrent client repository
https://transmissionbt.com
Other
12.02k stars 1.2k forks source link

Tr4 mainline cannot encrypted-connect with another Tr4 #6879

Closed reardonia closed 3 weeks ago

reardonia commented 3 months ago

What is the issue?

Have been testing various loopback scenarios and ran into this, though it repros when connecting across different machines.

4.0.x does not seem to have this problem. But, mainline @ a18fca59 has the problem, though not sure when the behavior began.

mainline will connect to a variety of other clients (UT, LT, etc) without problems. But it cannot connect to itself when encryption is Required. It seems to get thru most of the handshake but then drops the connection. Tr4<->Tr4 works fine when connection is unencrypted.

Note: the log shows "4.0.5" but this really is mainline @ a18fca59, the version number was forced to 4.0.5 during build.

Also Note: I had to comment out several tr_logAddTrace events due to segfaults. Seems like (io)->display_name() causes havoc in a lot of places, assume that (io) is being referenced after release? I'll file separate bug for this.

[2024-06-01 00:04:53.303] dbg cache.cc:119 Maximum cache size set to 64 MiB (4096 blocks) (cache.cc:119)
[2024-06-01 00:04:53.303] inf global-ip-cache.cc:358 Cached source address %%NETWORK%%.173 (global-ip-cache.cc:358)
[2024-06-01 00:04:53.303] trc global-ip-cache.cc:360 Cached source address %%NETWORK%%.173 (global-ip-cache.cc:360)
[2024-06-01 00:04:53.303] dbg global-ip-cache.cc:279 Successfully updated source IPv4 address to %%NETWORK%%.173 (global-ip-cache.cc:279)
[2024-06-01 00:04:53.303] inf global-ip-cache.cc:358 Cached source address %%NETWORK6%%::2 (global-ip-cache.cc:358)
[2024-06-01 00:04:53.303] trc global-ip-cache.cc:360 Cached source address %%NETWORK6%%::2 (global-ip-cache.cc:360)
[2024-06-01 00:04:53.303] dbg global-ip-cache.cc:279 Successfully updated source IPv6 address to %%NETWORK6%%::2 (global-ip-cache.cc:279)
[2024-06-01 00:04:53.303] dbg net.cc:365 Bound socket 14 to port 59938 on %%NETWORK%%.173 (net.cc:365)
[2024-06-01 00:04:53.303] inf session.cc:418 Listening to incoming peer connections on %%NETWORK%%.173:59938 (session.cc:418)
[2024-06-01 00:04:53.303] dbg net.cc:365 Bound socket 15 to port 59938 on :: (net.cc:365)
[2024-06-01 00:04:53.303] inf session.cc:418 Listening to incoming peer connections on [::]:59938 (session.cc:418)
[2024-06-01 00:04:53.303] trc port-forwarding.cc:91 stopped (port-forwarding.cc:91)
[2024-06-01 00:04:53.303] inf tr-udp.cc:198 Bound UDP IPv4 address %%NETWORK%%.173:59938 (tr-udp.cc:198)
[2024-06-01 00:04:53.303] inf tr-udp.cc:243 Bound UDP IPv6 address [::]:59938 (tr-udp.cc:243)
[2024-06-01 00:04:53.303] dbg rpc-server.cc:814 setting password-enabled to 'true' (rpc-server.cc:814)
[2024-06-01 00:04:53.303] inf rpc-server.cc:742 Added '127.0.0.1' to host whitelist (rpc-server.cc:742)
[2024-06-01 00:04:53.303] inf rpc-server.cc:742 Added '10.9.8.1' to host whitelist (rpc-server.cc:742)
[2024-06-01 00:04:53.303] inf rpc-server.cc:742 Added '10.9.8.2' to host whitelist (rpc-server.cc:742)
[2024-06-01 00:04:53.303] dbg rpc-server.cc:801 setting our username to '%%USERNAME%%' (rpc-server.cc:801)
[2024-06-01 00:04:53.303] dbg rpc-server.cc:808 setting our salted password to '%%PASSWORD%%' (rpc-server.cc:808)
[2024-06-01 00:04:53.303] inf rpc-server.cc:875 Serving RPC and Web requests on 10.9.8.1:51214/transmission/ (rpc-server.cc:875)
[2024-06-01 00:04:53.303] inf rpc-server.cc:692 Listening for RPC and Web requests on '10.9.8.1:51214' (rpc-server.cc:692)
[2024-06-01 00:04:53.303] inf rpc-server.cc:880 Whitelist enabled (rpc-server.cc:880)
[2024-06-01 00:04:53.303] inf rpc-server.cc:885 Password required (rpc-server.cc:885)
[2024-06-01 00:04:53.303] inf rpc-server.cc:891 Serving RPC and Web requests from '/home/%%USERNAME%%/transmission/web' (rpc-server.cc:891)
[2024-06-01 00:04:53.303] inf daemon.cc:720 Loading settings from '/home/%%USERNAME%%/transmission' (daemon.cc:720)
[2024-06-01 00:04:53.303] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/settings.json' (utils.cc:203)
[2024-06-01 00:04:53.303] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/bandwidth-groups.json' (utils.cc:203)
[2024-06-01 00:04:53.303] inf daemon.cc:756 Requiring authentication (daemon.cc:756)
[2024-06-01 00:04:53.303] inf %%TORRENTNAME%% loading (torrent.cc:954)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% Read resume file '/home/%%USERNAME%%/transmission/resume/%%HASH%%.resume' (resume.cc:620)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:56974 from=5 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:59937 from=5 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Loaded 2 IPv4 peers from resume file (resume.cc:77)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 queued 'started' (announcer.cc:810)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 [0:started] (announcer.cc:779)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 announcing in 0 seconds (announcer.cc:840)
[2024-06-01 00:04:53.303] inf session.cc:1481 Loaded 1 torrent (session.cc:1481)
[2024-06-01 00:04:53.303] trc web.cc:490 wrote 20 bytes to task 0x7ff68c003190's buffer (web.cc:490)
[2024-06-01 00:04:53.303] inf global-ip-cache.cc:213 Cached global address %%NETWORK6%%::2 (global-ip-cache.cc:213)
[2024-06-01 00:04:53.303] trc global-ip-cache.cc:215 Cached global address %%NETWORK6%%::2 (global-ip-cache.cc:215)
[2024-06-01 00:04:53.303] dbg global-ip-cache.cc:319 Successfully updated global IPv6 address to %%NETWORK6%%::2 using https://ip6.transmissionbt.com/ (global-ip-cache.cc:319)
[2024-06-01 00:04:53.303] trc web.cc:490 wrote 15 bytes to task 0x7ff68c001870's buffer (web.cc:490)
[2024-06-01 00:04:53.303] inf global-ip-cache.cc:213 Cached global address %%NETWORK%%.173 (global-ip-cache.cc:213)
[2024-06-01 00:04:53.303] trc global-ip-cache.cc:215 Cached global address %%NETWORK%%.173 (global-ip-cache.cc:215)
[2024-06-01 00:04:53.303] dbg global-ip-cache.cc:319 Successfully updated global IPv4 address to %%NETWORK%%.173 using https://ip4.transmissionbt.com/ (global-ip-cache.cc:319)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Announcing to tracker (announcer.cc:1577)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending IPv4 announce to libcurl: 'https://tracker.%%TRACKER%%.org/announce.php?passkey=%%PASSKEY%%&info_hash=%%INFOHASH%%&peer_id=-TR4050-1xq8tw45rakl&port=59938&uploaded=0&downloaded=0&left=0&numwant=80&key=25E7D16F&compact=1&supportcrypto=1&requirecrypto=1&event=started' (announcer-http.cc:274)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending IPv6 announce to libcurl: 'https://tracker.%%TRACKER%%.org/announce.php?%%PASSKEY%%&info_hash=%%INFOHASH%%&peer_id=-TR4050-1xq8tw45rakl&port=59938&uploaded=0&downloaded=0&left=0&numwant=80&key=25E7D16F&compact=1&supportcrypto=1&requirecrypto=1&event=started' (announcer-http.cc:274)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.147:56974 (peer-mgr.cc:2668)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:04:53.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:04:53.303] trc net.cc:216 SO_SNDBUF size is 16384 (net.cc:216)
[2024-06-01 00:04:53.303] trc net.cc:224 SO_RCVBUF size is 131072 (net.cc:224)
[2024-06-01 00:04:53.303] trc net.cc:303 New OUTGOING connection 21 (%%NETWORK%%.147:56974) (net.cc:303)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:56974 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.147:59937 (peer-mgr.cc:2668)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:04:53.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:04:53.303] trc net.cc:303 New OUTGOING connection 22 (%%NETWORK%%.147:59937) (net.cc:303)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 socket (tcp) is 22 (peer-socket.cc:43)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:59937 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got announce response (announcer-http.cc:113)
[2024-06-01 00:04:53.303] trc web.cc:490 wrote 456 bytes to task 0x7ff68c00c5f0's buffer (web.cc:490)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got announce response (announcer-http.cc:113)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 got a peers length of 6 (announcer-http.cc:132)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got announce response: connected:true timeout:false seeders:-1 leechers:-1 downloads:-1 interval:2717 min_interval:2717 tracker_id_str:none pex:6 pex6:0 err:none warn:none (announcer.cc:977)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 tracker gave a list of 6 peers. (announcer.cc:716)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Got 6 peers from tracker (torrent.cc:2023)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:56974 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:56974 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:56974 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.173:59936 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.147:56974 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% valid peer %%NETWORK%%.173:59938 from=2 (peer-mgr.cc:1410)
[2024-06-01 00:04:53.303] dbg %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 peer counts: -1 seeders, -1 leechers. (announcer.cc:701)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending periodic reannounce in 2717 seconds (announcer.cc:1141)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 queued '' (announcer.cc:810)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 [0:] (announcer.cc:779)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 announcing in 2717 seconds (announcer.cc:840)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_write err: wrote:0, errno:111 (Connection refused) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:56974 handshake socket err: Connection refused (111) (handshake.cc:636)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% marking peer %%NETWORK%%.147:56974 as unreachable... num_fails is 1 (peer-mgr.cc:1301)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 try_write err: wrote:0, errno:111 (Connection refused) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:59937 handshake socket err: Connection refused (111) (handshake.cc:636)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% marking peer %%NETWORK%%.147:59937 as unreachable... num_fails is 1 (peer-mgr.cc:1301)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:53.303] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:04:53.303] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:59937 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.173:59936 (peer-mgr.cc:2668)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.173:59936 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:04:53.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:04:53.303] trc net.cc:303 New OUTGOING connection 21 (%%NETWORK%%.173:59936) (net.cc:303)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.173:59936 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.173:59936 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.173:59938 (peer-mgr.cc:2668)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.173:59938 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:04:53.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:04:53.303] trc net.cc:303 New OUTGOING connection 22 (%%NETWORK%%.173:59938) (net.cc:303)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.173:59938 socket (tcp) is 22 (peer-socket.cc:43)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.173:59938 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:04:53.303] trc session.cc:397 new incoming connection 24 (%%NETWORK%%.173:37251) (session.cc:397)
[2024-06-01 00:04:53.303] trc %%NETWORK%%.173:37251 socket (tcp) is 24 (peer-socket.cc:43)
[2024-06-01 00:04:53.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 try_write err: wrote:0, errno:111 (Connection refused) (peer-io.cc:335)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:59936 handshake socket err: Connection refused (111) (handshake.cc:636)
[2024-06-01 00:04:54.304] trc %%TORRENTNAME%% marking peer %%NETWORK%%.173:59936 as unreachable... num_fails is 1 (peer-mgr.cc:1301)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59938 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:37251 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 in read_ya... need 96, have 261 (handshake.cc:358)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 in read_pad_a... need 20, read 146, have 19 (handshake.cc:390)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 try_write err: wrote:0, errno:32 (Broken pipe) (peer-io.cc:335)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:59938 handling can_read; state is [awaiting yb] (handshake.cc:564)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:59938 in read_yb... need 96, have 543 (handshake.cc:64)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:59938 in read_vc... need 8, read 440, have 7 (handshake.cc:152)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:54.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59936 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:37251 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:37251 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 sending vc (handshake.cc:516)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 sending pad d (handshake.cc:532)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:37251 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:04:54.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:37251 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59938 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:04:54.304] trc %%NETWORK%%.173:59938 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:04:54.304] trc handshake %%NETWORK%%.173:59938 handshake socket err: Transport endpoint is not connected (107) (handshake.cc:636)
[2024-06-01 00:04:54.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:05:00.301] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending scrape to libcurl: 'https://tracker.%%TRACKER%%.org/scrape.php?%%PASSKEY%%&info_hash=%%INFOHASH%%' (announcer-http.cc:543)
[2024-06-01 00:05:01.303] trc web.cc:490 wrote 82 bytes to task 0x7ff68c027760's buffer (web.cc:490)
[2024-06-01 00:05:01.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got scrape response for 'https://tracker.%%TRACKER%%.org/scrape.php?%%PASSKEY%%' (announcer-http.cc:496)
[2024-06-01 00:05:01.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 scraped url:https://tracker.%%TRACKER%%.org/scrape.php?%%PASSKEY%%  -- did_connect:true did_timeout:false seeders:2 leechers:1 downloads:14 downloaders:-1 min_request_interval:0 err:none  (announcer.cc:1317)
[2024-06-01 00:05:01.303] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Scrape successful. Rescraping in 1800 seconds. (announcer.cc:1362)
[2024-06-01 00:05:01.303] dbg %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 peer counts: 2 seeders, 1 leechers. (announcer.cc:701)
[2024-06-01 00:05:03.303] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.173:59938 (peer-mgr.cc:2668)
[2024-06-01 00:05:03.303] trc %%NETWORK%%.173:59938 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:05:03.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:05:03.303] trc net.cc:303 New OUTGOING connection 21 (%%NETWORK%%.173:59938) (net.cc:303)
[2024-06-01 00:05:03.303] trc %%NETWORK%%.173:59938 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:05:03.303] trc handshake %%NETWORK%%.173:59938 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:05:03.303] trc session.cc:397 new incoming connection 22 (%%NETWORK%%.173:41685) (session.cc:397)
[2024-06-01 00:05:03.303] trc %%NETWORK%%.173:41685 socket (tcp) is 22 (peer-socket.cc:43)
[2024-06-01 00:05:03.303] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:59938 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:41685 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 in read_ya... need 96, have 504 (handshake.cc:358)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 in read_pad_a... need 20, read 389, have 19 (handshake.cc:390)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:59938 handling can_read; state is [awaiting yb] (handshake.cc:564)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:59938 in read_yb... need 96, have 248 (handshake.cc:64)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:59938 in read_vc... need 8, read 145, have 7 (handshake.cc:152)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:41685 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:41685 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 sending vc (handshake.cc:516)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 sending pad d (handshake.cc:532)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:41685 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:05:04.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:41685 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:59938 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.173:59938 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:05:04.304] trc handshake %%NETWORK%%.173:59938 handshake socket err: Transport endpoint is not connected (107) (handshake.cc:636)
[2024-06-01 00:05:04.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:05:04.304] trc session.cc:397 new incoming connection 21 (%%NETWORK%%.147:52035) (session.cc:397)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.147:52035 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:05:04.304] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:05:04.304] trc %%NETWORK%%.147:52035 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:05.303] trc %%NETWORK%%.147:52035 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:05.303] trc %%NETWORK%%.147:52035 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 in read_ya... need 96, have 463 (handshake.cc:358)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 in read_pad_a... need 20, read 348, have 19 (handshake.cc:390)
[2024-06-01 00:05:05.303] trc %%NETWORK%%.147:52035 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:05.303] trc %%NETWORK%%.147:52035 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 sending vc (handshake.cc:516)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 sending pad d (handshake.cc:532)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:05:05.303] trc handshake %%NETWORK%%.147:52035 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:05:05.303] trc %%TORRENTNAME%% %%NETWORK%%.147:52035 [Transmission 4.0.5]: sending an ltep handshake (peer-msgs.cc:1090)
[2024-06-01 00:05:05.303] trc %%TORRENTNAME%% %%NETWORK%%.147:52035 [Transmission 4.0.5]: sending 'ltep' 0 [] (peer-msgs.cc:859)
[2024-06-01 00:05:05.303] trc %%TORRENTNAME%% %%NETWORK%%.147:52035 [Transmission 4.0.5]: sending 'fext-have-all' (peer-msgs.cc:859)
[2024-06-01 00:05:13.304] trc %%TORRENTNAME%% %%NETWORK%%.147:52035 [Transmission 4.0.5]: sending 'unchoke' (peer-msgs.cc:859)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:05:34.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:52035 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:05:34.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:52035 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:05:34.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:52035 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:34.304] trc %%TORRENTNAME%% purging peer %%NETWORK%%.147:52035 because its do_purge flag is set (peer-mgr.cc:2136)
[2024-06-01 00:05:34.304] trc %%TORRENTNAME%% removing bad peer %%NETWORK%%.147:52035 (peer-mgr.cc:2230)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:05:34.304] trc %%NETWORK%%.147:52035 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:05:34.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:05:35.304] trc session.cc:397 new incoming connection 21 (%%NETWORK%%.147:51425) (session.cc:397)
[2024-06-01 00:05:35.304] trc %%NETWORK%%.147:51425 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:05:35.304] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:05:35.304] trc %%NETWORK%%.147:51425 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:35.304] trc %%NETWORK%%.147:51425 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:35.304] trc %%NETWORK%%.147:51425 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:35.304] trc handshake %%NETWORK%%.147:51425 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:05:35.304] trc handshake %%NETWORK%%.147:51425 in read_ya... need 96, have 367 (handshake.cc:358)
[2024-06-01 00:05:35.304] trc handshake %%NETWORK%%.147:51425 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:05:35.304] trc handshake %%NETWORK%%.147:51425 in read_pad_a... need 20, read 252, have 19 (handshake.cc:390)
[2024-06-01 00:05:36.303] trc %%NETWORK%%.147:51425 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:05:36.303] trc %%NETWORK%%.147:51425 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 sending vc (handshake.cc:516)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 sending pad d (handshake.cc:532)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:05:36.303] trc handshake %%NETWORK%%.147:51425 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:05:36.303] trc %%TORRENTNAME%% %%NETWORK%%.147:51425 [Transmission 4.0.5]: sending an ltep handshake (peer-msgs.cc:1090)
[2024-06-01 00:05:36.303] trc %%TORRENTNAME%% %%NETWORK%%.147:51425 [Transmission 4.0.5]: sending 'ltep' 0 [] (peer-msgs.cc:859)
[2024-06-01 00:05:36.303] trc %%TORRENTNAME%% %%NETWORK%%.147:51425 [Transmission 4.0.5]: sending 'fext-have-all' (peer-msgs.cc:859)
[2024-06-01 00:05:43.303] trc %%TORRENTNAME%% %%NETWORK%%.147:51425 [Transmission 4.0.5]: sending 'unchoke' (peer-msgs.cc:859)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:06:05.305] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:51425 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:06:05.305] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:51425 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:06:05.305] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:51425 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:06:05.305] trc %%TORRENTNAME%% purging peer %%NETWORK%%.147:51425 because its do_purge flag is set (peer-mgr.cc:2136)
[2024-06-01 00:06:05.305] trc %%TORRENTNAME%% removing bad peer %%NETWORK%%.147:51425 (peer-mgr.cc:2230)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:06:05.305] trc %%NETWORK%%.147:51425 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:06:05.305] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:07:03.301] trc %%TORRENTNAME%% Starting an OUTGOING TCP connection with %%NETWORK%%.173:59938 (peer-mgr.cc:2668)
[2024-06-01 00:07:03.301] trc %%NETWORK%%.173:59938 new_outgoing()  (peer-io.cc:131)
[2024-06-01 00:07:03.301] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:07:03.301] trc net.cc:303 New OUTGOING connection 21 (%%NETWORK%%.173:59938) (net.cc:303)
[2024-06-01 00:07:03.301] trc %%NETWORK%%.173:59938 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:07:03.301] trc handshake %%NETWORK%%.173:59938 sending MSE handshake (Ya) (handshake.cc:43)
[2024-06-01 00:07:03.301] trc session.cc:397 new incoming connection 27 (%%NETWORK%%.173:38779) (session.cc:397)
[2024-06-01 00:07:03.301] trc %%NETWORK%%.173:38779 socket (tcp) is 27 (peer-socket.cc:43)
[2024-06-01 00:07:03.301] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:38779 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 in read_ya... need 96, have 398 (handshake.cc:358)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 in read_pad_a... need 20, read 283, have 19 (handshake.cc:390)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:59938 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:59938 handling can_read; state is [awaiting yb] (handshake.cc:564)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:59938 in read_yb... need 96, have 376 (handshake.cc:64)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:59938 in read_vc... need 8, read 273, have 7 (handshake.cc:152)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:38779 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:38779 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 sending vc (handshake.cc:516)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 sending pad d (handshake.cc:532)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:38779 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:07:04.302] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:38779 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:59938 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:07:04.302] trc %%NETWORK%%.173:59938 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:07:04.302] trc handshake %%NETWORK%%.173:59938 handshake socket err: Transport endpoint is not connected (107) (handshake.cc:636)
[2024-06-01 00:07:04.302] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:07:35.299] trc session.cc:397 new incoming connection 21 (%%NETWORK%%.147:59815) (session.cc:397)
[2024-06-01 00:07:35.299] trc %%NETWORK%%.147:59815 socket (tcp) is 21 (peer-socket.cc:43)
[2024-06-01 00:07:35.299] trc peer-io.cc:106 in tr_peerIo::create() (peer-io.cc:106)
[2024-06-01 00:07:35.299] trc %%NETWORK%%.147:59815 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:35.299] trc %%NETWORK%%.147:59815 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:07:35.299] trc %%NETWORK%%.147:59815 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:35.299] trc handshake %%NETWORK%%.147:59815 handling can_read; state is [awaiting ya] (handshake.cc:564)
[2024-06-01 00:07:35.299] trc handshake %%NETWORK%%.147:59815 in read_ya... need 96, have 259 (handshake.cc:358)
[2024-06-01 00:07:35.299] trc handshake %%NETWORK%%.147:59815 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:373)
[2024-06-01 00:07:35.299] trc handshake %%NETWORK%%.147:59815 in read_pad_a... need 20, read 144, have 19 (handshake.cc:390)
[2024-06-01 00:07:36.300] trc %%NETWORK%%.147:59815 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:07:36.300] trc %%NETWORK%%.147:59815 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 handling can_read; state is [awaiting pad a] (handshake.cc:564)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 found HASH('req1', S)! (handshake.cc:402)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 reading obfuscated torrent hash... (handshake.cc:430)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 got INCOMING connection's MSE handshake for torrent [1] (handshake.cc:442)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 crypto_provide is 2 (handshake.cc:465)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 len(PadC) is 0 (handshake.cc:468)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 len(IA) is 68 (handshake.cc:491)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 reading IA... have 68, need 68 (handshake.cc:500)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 sending vc (handshake.cc:516)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 selecting crypto mode '2' (handshake.cc:523)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 sending pad d (handshake.cc:532)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 read_handshake: need 48, got 68 (handshake.cc:230)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 sending handshake in reply (handshake.cc:304)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 read_peer_id: need 20, got 20 (handshake.cc:320)
[2024-06-01 00:07:36.300] trc handshake %%NETWORK%%.147:59815 peer-id is 'Transmission 4.0.5' ... isIncoming is true (handshake.cc:330)
[2024-06-01 00:07:36.300] trc %%TORRENTNAME%% %%NETWORK%%.147:59815 [Transmission 4.0.5]: sending an ltep handshake (peer-msgs.cc:1090)
[2024-06-01 00:07:36.300] trc %%TORRENTNAME%% %%NETWORK%%.147:59815 [Transmission 4.0.5]: sending 'ltep' 0 [] (peer-msgs.cc:859)
[2024-06-01 00:07:36.300] trc %%TORRENTNAME%% %%NETWORK%%.147:59815 [Transmission 4.0.5]: sending 'fext-have-all' (peer-msgs.cc:859)
[2024-06-01 00:07:43.303] trc %%TORRENTNAME%% %%NETWORK%%.147:59815 [Transmission 4.0.5]: sending 'unchoke' (peer-msgs.cc:859)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 libevent says this peer socket is ready for reading (peer-io.cc:477)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:08:05.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:59815 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:08:05.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:59815 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 try_read err: n_read:0 errno:107 (Transport endpoint is not connected) (peer-io.cc:460)
[2024-06-01 00:08:05.304] dbg %%TORRENTNAME%% setting %%NETWORK%%.147:59815 do_purge flag because we got [(107) Transport endpoint is not connected] (peer-mgr.cc:807)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 enabling ready-to-read polling (peer-io.cc:502)
[2024-06-01 00:08:05.304] trc %%TORRENTNAME%% purging peer %%NETWORK%%.147:59815 because its do_purge flag is set (peer-mgr.cc:2136)
[2024-06-01 00:08:05.304] trc %%TORRENTNAME%% removing bad peer %%NETWORK%%.147:59815 (peer-mgr.cc:2230)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 disabling ready-to-write polling (peer-io.cc:545)
[2024-06-01 00:08:05.304] trc %%NETWORK%%.147:59815 disabling ready-to-read polling (peer-io.cc:533)
[2024-06-01 00:08:05.304] trc peer-io.cc:197 in tr_peerIo destructor (peer-io.cc:197)
[2024-06-01 00:08:30.845] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/settings.json' (utils.cc:203)
[2024-06-01 00:08:30.845] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/bandwidth-groups.json' (utils.cc:203)
[2024-06-01 00:08:30.845] inf session.cc:1435 Transmission version 4.0.5 (0a6e54134c) shutting down (session.cc:1435)
[2024-06-01 00:08:30.845] inf rpc-server.cc:719 Stopped listening for RPC and Web requests on '10.9.8.1:51214' (rpc-server.cc:719)
[2024-06-01 00:08:30.845] trc port-forwarding.cc:91 stopped (port-forwarding.cc:91)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 [0:] (announcer.cc:779)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 queued 'stopped' (announcer.cc:810)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 [0:stopped] (announcer.cc:779)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 announcing in 0 seconds (announcer.cc:840)
[2024-06-01 00:08:30.845] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/resume/%%HASH%%.resume' (utils.cc:203)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending IPv4 announce to libcurl: 'https://tracker.%%TRACKER%%.org/announce.php?%%PASSKEY%%&info_hash=%%INFOHASH%%&peer_id=-TR4050-1xq8tw45rakl&port=59938&uploaded=0&downloaded=0&left=0&numwant=0&key=25E7D16F&compact=1&supportcrypto=1&requirecrypto=1&event=stopped' (announcer-http.cc:274)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Sending IPv6 announce to libcurl: 'https://tracker.%%TRACKER%%.org/announce.php?%%PASSKEY%%&info_hash=%%INFOHASH%%&peer_id=-TR4050-1xq8tw45rakl&port=59938&uploaded=0&downloaded=0&left=0&numwant=0&key=25E7D16F&compact=1&supportcrypto=1&requirecrypto=1&event=stopped' (announcer-http.cc:274)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got announce response (announcer-http.cc:113)
[2024-06-01 00:08:30.845] trc web.cc:490 wrote 11 bytes to task 0x7ff68c00ce80's buffer (web.cc:490)
[2024-06-01 00:08:30.845] trc %%TORRENTNAME%% at tracker.%%TRACKER%%.org:443 Got announce response (announcer-http.cc:113)
[2024-06-01 00:08:30.845] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/stats.json' (utils.cc:203)
[2024-06-01 00:08:30.845] trc utils.cc:203 Saved '/home/%%USERNAME%%/transmission/stats.json' (utils.cc:203)

Which application of Transmission?

transmission-daemon

Which version of Transmission?

4.1

tearfur commented 3 months ago

I haven't looked into this in detail yet, just listing some possible regression commits off the top of my head. 6384abeb2be8347e8840c1db78dd27bdb973a7f5 7973d873ffadaa555beadf979e8a245de57e66e9

reardonia commented 3 months ago

I haven't looked into this in detail yet, just listing some possible regression commits off the top of my head. 6384abe 7973d87

mainline 51995ab63f just prior to 7973d87 does not have problem, but 7973d87 does. So it looks like it's a problem in your big handshake rewrite.

tearfur commented 3 months ago

Hmm, just to confirm, can you point out the log snippets (<10 lines for each line) that makes you think that the connections are disconnecting after handshake?

I am guessing these:

[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_write err: wrote:0, errno:111 (Connection refused) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:56974 handshake socket err: Connection refused (111) (handshake.cc:636)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% marking peer %%NETWORK%%.147:56974 as unreachable... num_fails is 1 (peer-mgr.cc:1301)
reardonia commented 3 months ago

for comparison, a trace of 51995ab succeeding:

[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 socket (tcp) is 23 (peer-socket.cc:36)
[2024-06-01 17:04:56.998] trc net.cc:302 New OUTGOING connection 23 ([%%NETWORK%%.173]:59938) (net.cc:302)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 enabling ready-to-read polling (peer-io.cc:505)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for reading (peer-io.cc:480)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 enabling ready-to-read polling (peer-io.cc:505)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 handling canRead; state is [awaiting yb] (handshake.cc:682)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 got an encrypted handshake (handshake.cc:172)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 not enough bytes... returning read_more (handshake.cc:259)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:56.998] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for reading (peer-io.cc:480)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 enabling ready-to-read polling (peer-io.cc:505)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 handling canRead; state is [awaiting vc] (handshake.cc:682)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 got it! (handshake.cc:265)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 crypto select is 2 (handshake.cc:291)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 pad_d_len is 0 (handshake.cc:301)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 pad d: need 0, got 204 (handshake.cc:318)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 payload: need 48, got 204 (handshake.cc:335)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 peer-id is 'Transmission 4.0.7 (Dev)' ... isIncoming is false (handshake.cc:432)
[2024-06-01 17:04:57.995] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: sending an ltep handshake (peer-msgs.cc:931)
[2024-06-01 17:04:57.995] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: sending 'ltep' 0 [] (peer-msgs.cc:813)
[2024-06-01 17:04:57.995] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: sending 'fext-have-none' (peer-msgs.cc:813)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:57.995] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:59.000] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:59.000] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:59.000] trc [%%NETWORK%%.173]:59938 enabling ready-to-write polling (peer-io.cc:517)
[2024-06-01 17:04:59.000] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for writing (peer-io.cc:356)
[2024-06-01 17:04:59.992] trc [%%NETWORK%%.173]:59938 libevent says this peer socket is ready for reading (peer-io.cc:480)
[2024-06-01 17:04:59.992] trc [%%NETWORK%%.173]:59938 enabling ready-to-read polling (peer-io.cc:505)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: read 126 payload bytes; 0 left to go (peer-msgs.cc:1760)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: got peer msg 'ltep' (20) with payload len 126 (peer-msgs.cc:1395)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: Got a BtPeerMsgs::Ltep (peer-msgs.cc:1624)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: got ltep handshake (peer-msgs.cc:1242)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7 (Dev)]: here is the base64-encoded handshake: ...
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7-dev]: peer's port is now 59938 (peer-msgs.cc:1110)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7-dev]: got peer msg 'fext-have-all' (14) with payload len 0 (peer-msgs.cc:1395)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7-dev]: Got a BtPeerMsgs::FextHaveAll (peer-msgs.cc:1569)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7-dev]: got peer msg 'unchoke' (1) with payload len 0 (peer-msgs.cc:1395)
[2024-06-01 17:04:59.992] trc %%TORRENTNAME%% [%%NETWORK%%.173]:59938 [Transmission 4.0.7-dev]: got Unchoke (peer-msgs.cc:1431)
reardonia commented 3 months ago

Note that I think your rewrite dropped the trace message when self-connects are dropped. It happens in read_peer_id(). I'm guessing that your logic for "connected_to_self" is wrong? Are you comparing the clientForId string rather than the actual over-the-wire peer-id ?

Personally I don't understand why we don't filter these as OUTGOING connection before they ever get generated. This has been Tr behavior forever, but seems non-sensical. ie if my listening port is the same as the destination port, and my global-address is the same, then don't generate.

reardonia commented 3 months ago

Hmm, just to confirm, can you point out the log snippets (<10 lines for each line) that makes you think that the connections are disconnecting after handshake?

I am guessing these:

[2024-06-01 00:04:53.303] trc %%NETWORK%%.147:56974 try_write err: wrote:0, errno:111 (Connection refused) (peer-io.cc:335)
[2024-06-01 00:04:53.303] trc handshake %%NETWORK%%.147:56974 handshake socket err: Connection refused (111) (handshake.cc:636)
[2024-06-01 00:04:53.303] trc %%TORRENTNAME%% marking peer %%NETWORK%%.147:56974 as unreachable... num_fails is 1 (peer-mgr.cc:1301)

Yes, the OUTGOING MSE seems to get stuck at "read_vc". The INCOMING MSE seems fine.

tearfur commented 3 months ago

Hmm yes of course the mistake was going to be so trivial, I love programming. ^^

@reardonia Please have a try with the patch below.

diff --git a/libtransmission/handshake.cc b/libtransmission/handshake.cc
index 63297198e..3a41cd9a3 100644
--- a/libtransmission/handshake.cc
+++ b/libtransmission/handshake.cc
@@ -536,10 +536,12 @@ ReadState tr_handshake::read_ia(tr_peerIo* peer_io)
      * standard practice at this time is for it to be zero-length */
     outbuf.add_uint16(0U);

+    // send it
+    peer_io->write(outbuf, false);
+
     /* maybe de-encrypt our connection */
     if (crypto_select_ == CryptoProvidePlaintext)
     {
-        peer_io->write(outbuf, false);
         TR_ASSERT(std::empty(outbuf));

         // All future communications will use ENCRYPT2()
reardonia commented 3 months ago

Hmm yes of course the mistake was going to be so trivial, I love programming. ^^

@reardonia Please have a try with the patch below.

diff --git a/libtransmission/handshake.cc b/libtransmission/handshake.cc
index 63297198e..3a41cd9a3 100644
--- a/libtransmission/handshake.cc
+++ b/libtransmission/handshake.cc
@@ -536,10 +536,12 @@ ReadState tr_handshake::read_ia(tr_peerIo* peer_io)
      * standard practice at this time is for it to be zero-length */
     outbuf.add_uint16(0U);

+    // send it
+    peer_io->write(outbuf, false);
+
     /* maybe de-encrypt our connection */
     if (crypto_select_ == CryptoProvidePlaintext)
     {
-        peer_io->write(outbuf, false);
         TR_ASSERT(std::empty(outbuf));

         // All future communications will use ENCRYPT2()

Yeah, that fixes it, but for the wrong reasons. Something changed in the rewrite of handshake that needs closer examination.

In read_ia you seemed to preserve all the logic from Tr3, including waiting to commit the write() based on falling back to disabling crypto. Oddly enough, when I was testing handshakes in Tr3 I added this comment:

    // BUGBUG why would this ever happen?
    /* maybe de-encrypt our connection */
    if (crypto_select == CRYPTO_PROVIDE_PLAINTEXT)

Which means I thought this was buggy or questionable in Tr3 and should likely be dropped in Tr4. I don't understand logically why we would drop down to PLAINTEXT at this point in the negotiation. We should look at this more closely.

There are two main concerns (maybe four): 1) Tr3 was able to commit a write in ReadIA that is missing in your new read_ia. It looks like you were trying to fold all the "payload" stuff together instead of the bizarre way the Tr3 treating encrypted-payload and plaintext-payload as two separate paths. From end of read_ia in Tr3:

    /* send it out */
    tr_peerIoWriteBuf(handshake->io, outbuf, false);
    evbuffer_free(outbuf);

2) Why was this a problem for Tr4 <-> Tr4 but not other clients? Doesn't make sense to me. The VC was never written by Tr4 mainline, so how does it get past this event?

3) If you want to preserve the Tr3 logic, then the write() should happen after you disable encrypt?

4) There is an off-by-one error somewhere in read_pad_a and read_vc, in the resync logic. Both of those functions are called twice, eg:

[2024-06-03 19:19:52.087] trc handshake XXXX:59938 handling can_read; state is [awaiting yb] (handshake.cc:608)
[2024-06-03 19:19:52.087] trc handshake XXXX:59938 in read_yb... need 96, have 587 (handshake.cc:68)
[2024-06-03 19:19:52.087] trc handshake XXXX:59938 in read_vc... need 8, read 484, have 7 (handshake.cc:166)
[2024-06-03 19:19:52.087] trc XXXX:59938 enabling ready-to-write polling (peer-io.cc:521)
[2024-06-03 19:19:52.087] trc XXXX:59938 libevent says this peer socket is ready for writing (peer-io.cc:359)
[2024-06-03 19:19:52.087] trc XXXX:59938 libevent says this peer socket is ready for reading (peer-io.cc:484)
[2024-06-03 19:19:52.087] trc XXXX:59938 enabling ready-to-read polling (peer-io.cc:509)
[2024-06-03 19:19:52.087] trc handshake XXXX:59938 handling can_read; state is [awaiting vc] (handshake.cc:608)
[2024-06-03 19:19:52.087] trc handshake XXXX:59938 found ENCRYPT(VC)! (handshake.cc:174)

Same happens with read_pad_a on the INCOMING connection. Maybe pre- vs post-increment in the resync loop?

reardonia commented 3 months ago

Some more thoughts on this resync problem.

The MSE spec says:

The handshake is seperated into 5 blocking steps.

1 A->B: Diffie Hellman Ya, PadA
2 B->A: Diffie Hellman Yb, PadB
3 A->B: HASH('req1', S), HASH('req2', SKEY) xor HASH('req3', S), ENCRYPT(VC, crypto_provide, len(PadC), PadC, len(IA)), ENCRYPT(IA)
4 B->A: ENCRYPT(VC, crypto_select, len(padD), padD), ENCRYPT2(Payload Stream)
5 A->B: ENCRYPT2(Payload Stream)

This is logically true but programmatically false. Really it should be:

1 A->B: Diffie Hellman Ya
2 B->A: Diffie Hellman Yb, PadB, ENCRYPT(VC)
3 A->B: PadA, HASH('req1', S), HASH('req2', SKEY) xor HASH('req3', S), ENCRYPT(VC, crypto_provide, len(PadC), PadC, len(IA)), ENCRYPT(IA)
4 B->A:  ENCRYPT(crypto_select, len(padD), padD), ENCRYPT2(Payload Stream)
5 A->B: ENCRYPT2(Payload Stream)

In step (2), client B cannot do anything with the PadA until it receives the first HASH in step (3). So there is no reason to send PadA with Ya. Client A should just wait to send PadA until it has obtained Yb and can form HASH('req1').

Slightly different for client B, which should send the resync info ENCRYPT(VC) with the PadB.

I recognize that you open up to simple traffic blocking & shaping if the opening packet is always 96 bytes, hence PadA is always sent with Ya. HOWEVER, in Tr4 code, at a minimum we should alter read_ya and read_yb to both exit with READ_LATER instead of READ_NOW, since there is nothing to do until we received the second packet with resync bytes. I've made this change locally and it now avoids the double-call into read_vc or read_pad_a:

[2024-06-03 21:26:08.558] trc handshake XXXX:57005 handling can_read; state is [awaiting ya] (handshake.cc:619)
[2024-06-03 21:26:08.558] trc handshake XXXX:57005 in read_ya... need 96, have 266 (handshake.cc:387)
[2024-06-03 21:26:08.558] trc handshake XXXX:57005 sending B->A: Diffie Hellman Yb, PadB (handshake.cc:412)
[2024-06-03 21:26:09.560] trc XXXX:57005 enabling ready-to-write polling (peer-io.cc:521)
[2024-06-03 21:26:09.560] trc XXXX:57005 libevent says this peer socket is ready for writing (peer-io.cc:359)
[2024-06-03 21:26:09.560] trc XXXX:57005 libevent says this peer socket is ready for reading (peer-io.cc:484)
[2024-06-03 21:26:09.560] trc XXXX:57005 enabling ready-to-read polling (peer-io.cc:509)
[2024-06-03 21:26:09.560] trc handshake XXXX:57005 handling can_read; state is [awaiting pad a] (handshake.cc:619)
[2024-06-03 21:26:09.560] trc handshake XXXX:57005 found HASH('req1', S)! (handshake.cc:445)
tearfur commented 3 months ago

To respond to your main concerns:

  1. Isn't this precisely what my patch is trying to fix?
  2. I'm pretty sure the handshake will also fail when a non-Tr client initiates an MSE handshake with a Tr4 mainline client.
  3. In the current code, within read_ia(), we no longer send anything after disabling encryption, so commiting a write once prior will be sufficient.
  4. I was gonna say there's nothing to worry about here, then I realised the things you wrote in the next comment superscedes your point here.

    I agree that in the current code, returning READ_LATER in read_ya() and read_yb() is probably safe and avoids some extra function calls, but it's too much fine-tuning for my comfort, and for such little gain.

    I'd rather keep it consistent with the other functions, and not having to risk forgetting its reasonings in the future, make some changes that break it, then end up spending hours figuring out why read_ya() and read_yb() differs from the other functions, just to find out it is just a minor optimisation.

I don't understand logically why we would drop down to PLAINTEXT at this point in the negotiation. We should look at this more closely.

Well, it rarely happens in practice, and I don't know why any client would want to do this either. In any case, this is part of the MSE spec, and there isn't a good reason not to support it as far as I'm concerned, so we support it.

tearfur commented 3 months ago

Personally I don't understand why we don't filter these as OUTGOING connection before they ever get generated.

Because you can't rule out the possibility that after port forwarding, another client is exposed to the public Internet using the port you are listening on.